home *** CD-ROM | disk | FTP | other *** search
/ LSD Docs / LSD Docs.iso / FILEZ / lsd32.dms / lsd32.adf / AmigaGfx6.pp / AmigaGfx6
Text File  |  1990-09-07  |  221KB  |  6,268 lines

  1.  _________________________________________________________________________
  2. /#########################################################################\
  3. |#####...####..######..######......####...####..#####..##......##......###|
  4. |####.....###..######..########..#####.....###...####..##..######..#######|
  5. |###..###..##..######..########..####..###..##....###..##..######..#######|
  6. |###..###..##..######..########..####..###..##..#...#..##..######......###|
  7. |###.......##..######..########..####.......##..##.....##..######..#######|
  8. |###..###..##..######..########..####..###..##..###....##..######..#######|
  9. |###..###..##...#####...#######..####..###..##..####...##..######..#######|
  10. |###..###..##......##......##......##..###..##..#####..##......##......###|
  11. |#########################################################################|
  12. |####################################################################{RB}#|
  13. |=========================================================================|
  14. |                                      |
  15. |                   ----> PRESENTS <----                  |
  16. |                                      |
  17. |            AMIGA GRAPHICS INSIDE AND OUT - THE COMPLETE BOOK            |
  18. |                                      |
  19. |                 > PART 6 <                  |
  20. |                                      |
  21. | Typed / Scanned / Edited By : RAZOR BLADE.                      |
  22. | Additional Typing by        : GLITCH ( + 8 pages by Asterix ! ).      |
  23. | Original Supplied by          : VIPER                      |
  24. |                                      |
  25. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|
  26. |         CALL THE ALLIANCE WORLD HQ -> THE PLACE TO BE             |
  27. |       UNKNOWN PLEASURES --> +44 (0) 823 322 891 --> SYSOP: BARBARIAN    |
  28. |_________________________________________________________________________|
  29.  
  30. -----------------------------------------------------------------------------
  31.  
  32. 18.3 AnimObs and AnimComps
  33.  
  34. Displaying only "static" bobs isn't very exciting. Because of this, a 
  35. special animation system was created specifically for bobs. At the 
  36. beginning of this C language section, you learned one method of animation 
  37. called "color cycling" or color animation. We cycled, or scrolled, the colors 
  38. in the color registers. The contents of the preceding register were 
  39. exchanged for the contents of the current register, etc.
  40.  
  41. You also learned a second type of animation. When you moved your bobs and 
  42. vsprites they were also animated. You may be thinking that a 
  43. Commodore 64 is also able to do this. Although this is true, the Amiga is 
  44. also capable of animating bobs using the operating system software and 
  45. drawing a bob in different sequences without any commands.
  46.  
  47. The Amiga can recognise Animation Objects called AnimObs. We define 
  48. AnimObs with AnimationComponents, which are named AnimComps. The AnimComps 
  49. contain our defined bobs. For example, you could create the flight of a 
  50. seagull with different bob sequences. Then you could link these bobs with 
  51. the AnimComps and create an AnimOb.
  52.  
  53.  
  54. The first step of this process is to create all your bobs as you usually do. 
  55. In addition to the flags, you must determine how the bob is written into 
  56. the bit-map (OVERLAY, SAVEBACK, etc.) and set the bobs
  57.  
  58.                 PAGE 479
  59.  
  60. -----------------------------------------------------------------------------
  61.  
  62. BOBISCOMP flag. This tells the animation software that your bob is an 
  63. animation component. You must also tell the system to which animation 
  64. component your bob belongs. To do this, set the pointer Bob.BobComp for 
  65. the corresponding Animcomp structure. Each animated bob requires its 
  66. own AnimComp structure.
  67.  
  68. To link the AnimComps together, use the pointers AnimComp.NextComp and
  69. AnimComp.PrevComp. These two pointers point to the previous and next 
  70. AnimComps. Be careful because When you create a loop here it should 
  71. point only to a single AnimComp. Also, for all other AnimComps, you must 
  72. set these pointers to zero. If you don't do this, the system will think 
  73. that an AnimComp in the sequence points to a second bird instead of to the 
  74. one now animated.
  75.  
  76. Next there is the pointers NextSeq and PrevSeq. From one position you can 
  77. define many positions (as bobs) and then have the animation system page 
  78. through your sequences. This is similar to the old "Thumb movie books" 
  79. which simulated animation when you rapidly paged through a series of 
  80. pictures. Each new page of the bob creates the animation effect.
  81.  
  82. The next step is to set the sequence to cycle the pages. The pointers 
  83. NextSeq and PrevSeq point to the next and previous page or AnimComp. 
  84. These pointers create a closed ring. This means that you connect all the 
  85. AnimComps to each other with the pointers NextSeq and PrevSeq. The 
  86. previous AnimComp for the first AnimComp is the last AnimComp. 
  87. The next AnimComp from the last AnimComp is the first AnimComp.
  88.  
  89.                 PAGE 480
  90.  
  91. -----------------------------------------------------------------------------
  92.  
  93. Setting the RINGTRIGGER flag in the AnimComps(AnimComp.Flags = RINGTRIGGER), 
  94. which defines the ring, klls the system to flip the pages for the different 
  95. AnimComps. You can also set the length of time a specific AnimComp should be 
  96. displayed.
  97.  
  98. The variable AnimComp.TimeSet determines for how many Animate calls the 
  99. AnimComp will remain visible (Animate is the system routine that uses the 
  100. AnimObs). Animate copies the variable TimeSet to the variable Timer at the 
  101. beginning of a sequence. Timer is decremented with each Animate. Whenever 
  102. Timer equals zero, the next AnimComp in the sequence is displayed.
  103.  
  104. Now we will continue to define AnimComps and AnimObs. Just as a bob must 
  105. know which AnimComp it belongs to, the AnimComp must also know which bob it 
  106. represents. To accomplish this we point the AnimComp.AnimBob poinkr to the 
  107. specific bob.
  108.  
  109. To add something special, you can also specify one of your own routines 
  110. that will be executed each time you call Animate to display your AnimComps. 
  111. The pointer AnimComp.AnimCRoutine points to your function. Simply set this 
  112. pointer to zero when you haven't
  113.  
  114.                 PAGE 481
  115.  
  116. -----------------------------------------------------------------------------
  117.  
  118. defined a function. When using this function you must remember that it 
  119. returns a word value to your program. This value is not passed to the 
  120. system. Because this declaration affects the AnimComp structure, you should 
  121. check the returned value for any warning from the compiler.
  122.  
  123. Similar to the collision routines that are used with vsprites and bobs, 
  124. your functions can use the current AnimComp structure. For example, they 
  125. can check for a position and determine a specific action, or determine 
  126. object distances and react.
  127.  
  128. We are almost finished with our discussion of the AnimComp structure. But 
  129. before we explain our last point, we will discuss the AnimOb structure .
  130.  
  131. The AnimOb structure can contain many sequence rings. For example, it can 
  132. contain the arms, legs, body and the head of a man. All of these are 
  133. connected to each other and are able to move independently. We define the 
  134. components as a ring sequence which is automatically sequenced by Animate. 
  135. We represent the body with a single AnimComp structure because the body 
  136. itself usually does not move while walking.
  137.  
  138. The two pointers PrevComp and NextComp point to the AnimComps that display 
  139. the front and back view of the man. To link the AnimComps with the AnimOb 
  140. we use another pointer in the AnimOb structure. The pointer AnimOb.HeadComp 
  141. poinls to the first AnimComp that contains the rest of the objects. 
  142. (You link the components together with PrevComp and NextComp). Each 
  143. AnimComp contains a pointer back to the AnimOb. The pointer AnimComp.HeadOb 
  144. always points to the AnimOb in which the AnimComps are included. 
  145. This way you can easily access, with your routines, the required AnimOb 
  146. through the AnimComp structure.
  147.  
  148. However, more is required in order to initialise an animOb structure. 
  149. We still must determine where the structure will appear on the scrcen. 
  150. To solve this problem we use the variables Animob.Anx and AnimOb.AnY. 
  151. You cannot specify a coordinate using, for example, 160,100. 
  152. To specify the Animob coordinates, you must use a type of fixed decimal 
  153. method. The lower six bits are positioned after (to the right of) the decimal 
  154. point. To position your Animob you must multiply the RastPort coordinate 
  155. by 64.
  156.  
  157. You may be wondering why we are using such a strange positioning method. 
  158. However, remember that these variables set not only the objects' position 
  159. but also the velocity.
  160.  
  161. With each call of Animate the values from AnimOb.XAccel and AnimOb.YAccel 
  162. (X/Y movement) are added to AnimOb.XVel and
  163.  
  164.                 PAGE 482
  165.  
  166. -----------------------------------------------------------------------------
  167.  
  168. AnimOb.YVel (speed). The speed is then added to the position set by 
  169. AnimOb.Anx and AnimOb.AnY.
  170.  
  171. Using normal pixel values for position, speed, and movement could make your 
  172. Animob race across the screen. However, it wouldn't be very useful to have 
  173. Animob that disappears from the screen after the fifth call to Animate. 
  174. To prevent this, an Animob is moved only one pixel for every 64.
  175.  
  176. At first, it seems like this will be a problem. Multiplying by 64 is 
  177. possible, but using normal methods to move our Animob anywhere in
  178. a RastPort presents a challenge. For the positions (Anx and Any) we have #
  179. only 16 bits available. Normally this would provide values from -32768 to 
  180. +32768. But dividing this value by 64, gives us a range of -512 to +512. 
  181. So in order to position an object at an X coordinate of 629 in a hi-res 
  182. RastPort we have to  use a trick instead of the normal methods.
  183.  
  184. We can now explain the last feature of AnimComps. It is possible to specify 
  185. the position of the individual animation components relative to animation 
  186. objects (also in steps of 64).
  187.  
  188. When you use an offset of 128*64 in AnimComp.XTrans for your animation 
  189. components you can reach any coordinate on the screen. Set positions smaller 
  190. than 128 (values between -128 and zero) in AnimOb.AnX. Values between -512 
  191. and +512 for the Y position work in any resolution. To set your components 
  192. relative Y positions, use the variable AnimComp.YTrans.
  193.  
  194. Two other variables that can be used to position an object are RingxTrans 
  195. and RingYTrans. Simply add, wilhout any changes, the value of these variables 
  196. to the current position. If you do not require any speed or motion, just 
  197. set the corresponding AnimOb variables(Xvel, YVel, XAccel and YAccel ) equal 
  198. to zero. Then initialise RingXTrans and RingYTrans with your desired values. 
  199. Make sure your speed is uniform otherwise it will affect your animation 
  200. sequences. You must synchronize the internal movements of an object 
  201. (like the wings of a bird or rotation of a wheel) with any position changes. 
  202. For example, the rotation of a wheel being slower than the forward movement 
  203. as you increase the forward speed and the wheel always rotates at the same 
  204. speed.
  205.  
  206. You can also specify a routine for your animation object that is called by 
  207. Animate. The poinler for this routine is named AnimORoutine. It is also of 
  208. the type word and you must specify the AnimOb, not the component
  209.  
  210.                 PAGE 483
  211.  
  212. -----------------------------------------------------------------------------
  213.  
  214. Now that we have initialised all the animation structures, the bob, 
  215. the component and the object, the only thing left to do is to display it on 
  216. the screen.
  217.  
  218. Again we need a completely initialised GelsInfo structure used for bobs and #
  219. linked with a RastPort.
  220.  
  221. By using AddAnimOb(&AnimOb,&Key,&RastPort) we add all bobs and components of 
  222. the AnimOb to the GelsInfo structure. A required entry named Key is simply a 
  223. pointer to an AnimOb (struct AnimOb *Key = 0) that must be set to zero for 
  224. the first AddAnimOb call.
  225.  
  226. Because a list doesn't exist for the Animobs, you must know which AnimOb was 
  227. entered last in the GEL list. This helps ensure that the objects have been 
  228. properly linked. Also link the Animobs together by using the Animob.PrevOb 
  229. and AnimOb.NextOb pointers. The Key always points to the last entered Animob.
  230.  
  231. AddAnimOb handles more than linking the objects and entering the bobs in the 
  232. GEL list. It also sets the Timer variable for the AnimComps to the value 
  233. previously set in TimeSet. This permits decrementing the Timer.
  234.  
  235. Once you have processed all of the Animobs wilh AddAnimOb you are ready to 
  236. begin. Call Animate and the Timer variable for the current AnimComps is
  237. decremented. When Timer == 0 the next sequence is activated. The position 
  238. controlled by RingXTrans, RingYTrans, Xvel, YVel, XAccel, YAccel, Xtrans and 
  239. YTrans is Calculated and then used lo display the next bob.
  240.  
  241. When you call SortGList and DrawGList as usual, your AninObs are displayed on 
  242. the screen.
  243.  
  244. 18.3.1  Collisions with AnimObs
  245.  
  246. Because the smallest element used to display AnimObs are bobs, you can also 
  247. use them for collision control. Set the HitMask and Memask in the vsprite 
  248. structure of the bobs (using the same values for all bobs in one AnimComp 
  249. loop). Then you use SetCollision with your routine and test for collisions.
  250.  
  251. We have provided another example program so that you can actually see what 
  252. happens. This animation displays a flying seagull with flapping wings 
  253. (in one Animob):
  254.  
  255.                 PAGE 484
  256.  
  257. -----------------------------------------------------------------------------
  258.  
  259. /****************************************************************/
  260. /*                              LetsAnimate.c                   */
  261. /*                                                              */
  262. /* This program displays and moves an Amiga AmimOb              */
  263. /* (here a Segull and uses AnmiComps (different                 */
  264. /* wing positions                                               */
  265. /* Compiled with Aztec C V3.6a                                  */
  266. /*              cc +L -S LetsAnimate.c                          */
  267. /*              ln LetsAnimate.o -1c32                          */
  268. /* (c) Program by Bruno Jennrich, Idea and Artwork by           */
  269. /* my little sister Ute.                                        */
  270. /****************************************************************/
  271.  
  272. #include        "exec/types.h"
  273. #include        "exec/memory.h"
  274. #include        "exec/devices.h"
  275. #include        "devices/keymap.h"
  276. #include        "graphics/gfx.h"
  277. #include        "graphics/gfxmacros.h"
  278. #include        "graphics/copper.h"
  279. #include        "graphics/gels.h"
  280. #include        "graphics/gfxbase.h"
  281. #include        "graphics/regions.h"
  282. #include        "hardware/blit.h"
  283. #include        "hardware/custom.h"
  284. #include        "intuition/intuition.h"
  285. #include        "intuition/intuitionbase.h"
  286. #include        "libraries/diskfont.h"
  287. #include        "hardware/dmabits.h"
  288.  
  289. extern WORD MoveSeagull();              /*User AnimOb-Routine   */
  290. /* extern WORD Comp();          Optional AnimComp Routine       */
  291.  
  292. #define RP Screen->RastPort             /* Pointer to RastPort  */
  293. #define MAXBOBS 8                       /* Seagull in in 8 Positions */
  294.  
  295. #define MAXCOORDS (MAXBOBS*2-2)         /* Sequence consists of */
  296.                     /* 14 pictures: 8 'to'  */
  297.                     /* and 6 'back'.        */
  298.  
  299. struct GfxBase *GfxBase;                /* BasePointer          */
  300. struct IntuitionBase *IntuitionBase;
  301.  
  302. struct NewScreen NewScreen =            /* User Screen          */
  303.         {
  304.         0,0,640,200,1,
  305.         1,0,
  306.         HIRES,
  307.         CUSTOMSCREEN,
  308.         NULL,
  309.         "",
  310.         NULL,NULL
  311.         };
  312.  
  313. struct Screen *Screen;
  314.  
  315. struct VSprite Start, Ende,             /* VSprites for GEL     */
  316.     BobsVSprite[MAXCOMPS];          /*List and Bobs         */
  317.  
  318. struct Bob Bobs [MAXCOMPS];             /* User Bobs            */
  319.                     /* Note: 6 Bobs have the*/
  320.                     /* same image!!!        */
  321.  
  322.                 PAGE 485
  323.  
  324. -----------------------------------------------------------------------------
  325.  
  326. UWORD   *BobBuffer;
  327.     /* MAXBOBS Bobs, 20 Lines of 3 WORDs for        */
  328.     /* one BitPlane */
  329.  
  330.     /* memory area for SAVEBACK                     */
  331.     /* In this example one buffer                   */
  332.     /* is enough, but because of                    */
  333.     /* the principle and to simply                  */
  334.     /* use new and other Bobs,                      */
  335.     /* we have given each Bob a                     */
  336.     /* 'SaveBuffer'                                 */
  337.  
  338. UWORD   *BobMask;                       /* Bob collisions-Masks */
  339.                     /* Memory               */
  340.                     /* (20 Lines * 3 Words) */
  341.  
  342. UWORD   BobBorderLine[MAXCOMPS][3];     /* Bobs Borderline      */
  343.                     /* Memory               */
  344.                     /* logical OR of all    */
  345.                     /* Bob lines in one     */
  346.                     /* line (here:3 Words)  */
  347.  
  348. /*extern struct Custom custom;          in custom.h */
  349.                     /* pointer to Hardware  */
  350.                     /* Register for Copper  */
  351.  
  352. struct UCopList *UCopList;              /* own Copper List      */
  353.  
  354. struct  AnimComp AnimComp[MAXCOMPS];
  355.                     /* seagull 'back and forth     */
  356.                     /* bit Start (Sequence 1) and  */
  357.                     /* end position (Sequence8)    */
  358.                     /* appear in each sequence     */
  359.                     /* only once, not twice        */
  360.                     /* like the other positions    */
  361.                     /* for the Seagull             */
  362.  
  363. struct AnimOb *HeadOb = 0,              /* Animations Key              */
  364.     Seagull;                        /* our Seagull                 */
  365.  
  366. struct GelsInfo GelsInfo;               /* GelsInfo initialization     */
  367.                     /* must be completed before    */
  368.                     /* using the Animation         */
  369.                     /* routine!                    */
  370.  
  371. UWORD   *Image,*Help;
  372. UWORD   BobImage[MAXBOBS][20][3] =
  373.         {{
  374.  
  375.         {0x0080,0x0000,0x0100}, /* Data for                     */
  376.         {0x0080,0x0000,0x0100}, /* Bob1. Only one               */
  377.         {0x00c0,0x0000,0x0300}, /* BitPlane per                 */
  378.         {0x0040,0x0000,0x0200}, /* Bob                          */
  379.         {0x0060,0x0000,0x0600},
  380.         {0x0030,0x0000,0x0c00}, /* Please use the               */
  381.         {0x0010,0x0000,0x0800}, /* copy function                */
  382.         {0x0018,0x0000,0x1800}, /* of your editor               */
  383.         {0x000c,0x0000,0x3000}, /* and save                     */
  384.         {0x0004,0x0000,0x2000}, /* yourself a lot               */
  385.         {0x0006,0x0000,0x6000}, /* of work!                     */
  386.         {0x0003,0x0000,0xc000},
  387.         {0x0001,0x8001,0x8000},
  388.         {0x0000,0xc003,0x0000},
  389.         {0x0000,0x700e,0x0000},
  390.  
  391.                 PAGE 486
  392.  
  393. -----------------------------------------------------------------------------
  394.  
  395.         {0x0000,0x1c38,0x0000}, /* Here is where                */
  396.         {0x0000,0x0660,0x0000}, /* the data                     */
  397.         {0x0000,0x0180,0x0000}, /* for more                     */
  398.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  399.         {0x0000,0x0180,0x0000}  /* follows                      */
  400.     },
  401.     {
  402.         {0x0000,0x0000,0x0000}, /* Data for                     */
  403.         {0x0000,0x0000,0x0000}, /* Bob2. Only one               */
  404.         {0x0200,0x0000,0x0040}, /* BitPlane.                    */
  405.         {0x0100,0x0000,0x0080},
  406.         {0x0080,0x0000,0x0100},
  407.         {0x0060,0x0000,0x0600},
  408.         {0x0030,0x0000,0x0c00},
  409.         {0x0018,0x0000,0x1800},
  410.         {0x000c,0x0000,0x3000},
  411.         {0x0006,0x0000,0x6000},
  412.         {0x0003,0x0000,0xc000},
  413.         {0x000l,0x8001,0x8000},
  414.         {0x0000,0xe007,0x0000},
  415.         {0x0000,0x300c,0x0000},
  416.         {0x0000,0x1818,0x0000},
  417.         {0x0000,0x0c30,0x0000}, /* Here is where                */
  418.         {0x0000,0x0660,0x0000}, /* the data                     */
  419.         {0x0000,0x0180,0x0000}, /* for more                     */
  420.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  421.         {0x0000,0x0180,0x0000}  /* follows                      */
  422.     },
  423.     {
  424.         {0x0000,0x0000,0x0000}, /* Data for                     */
  425.         {0x0000,0x0000,0x0000}, /* Bob3. Only one               */
  426.         {0x0000,0x0000,0x0000}, /* BitPlane.                    */
  427.         {0x0f00,0x0000,0x00f0},
  428.         {0x00c0,0x0000,0x0300},
  429.         {0x0060,0x0000,0x0600},
  430.         {0x0018,0x0000,0x1800},
  431.         {0x0006,0x0000,0x6000},
  432.         {0x0003,0x0000,0xc000},
  433.         {0x0001,0x8001,0x8000},
  434.         {0x0000,0x4002,0x0000},
  435.         {0x0000,0x2004,0x0000},
  436.         {0x0000,0x1008,0x0000},
  437.         {0x0000,0x0810,0x0000},
  438.         {0x0000,0x0c30,0x0000},
  439.         {0x0000,0x0660,0x0000}, /* Here is where                */
  440.         {0x0000,0x0240,0x0000}, /* the data                     */
  441.         {0x0000,0x03c0,0x0000}, /* for more                     */
  442.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  443.         {0x0000,0x0180,0x0000}  /* follows                      */
  444.     },
  445.     {
  446.         {0x0000,0x0000,0x0000}, /* Data for                     */
  447.         {0x0000,0x0000,0x0000}, /* Bob4. Only one               */
  448.         {0x0000,0x0000,0x0000}, /* BitPlane.                    */
  449.         {0x0000,0x0000,0x0000},
  450.         {0x3000,0x0000,0x000c},
  451.         {0x0f80,0x0000,0x01f0},
  452.         {0x0070,0x0000,0x0e00},
  453.         {0x000c,0x0000,0x3000},
  454.         {0x0003,0x0000,0xc000},
  455.         {0x0001,0x8001,0x8000},
  456.         {0x0000,0x6006,0x0000},
  457.         
  458.                 PAGE 487
  459.  
  460. -----------------------------------------------------------------------------
  461.  
  462.         {0x0000,0x300c,0x0000},
  463.         {0x0000,0x1818,0x0000},
  464.         {0x0000,0x0c30,0x0000},
  465.         {0x0000,0x0420,0x0000},
  466.         {0x0000,0x0240,0x0000}, /* Here is where                */
  467.         {0x0000,0x03c0,0x0000}, /* the data                     */
  468.         {0x0000,0x0180,0x0000}, /* for more                     */
  469.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  470.         {0x0000,0x0180,0x0000}  /* follows                      */
  471.     },
  472.     {
  473.         {0x0000,0x0000,0x0000}, /* Data for                     */ 
  474.         {0x0000,0x0000,0x0000}, /* Bob5. Only one               */ 
  475.         {0x0000,0x0000,0x0000}, /* BitPlane.                    */
  476.         {0x0000,0x0000,0x0000},
  477.         {0x0000,0x0000,0x0000},
  478.         {0x0000,0x0000,0x0000},
  479.         {0x7ff0,0x0000,0x0ffe},
  480.         {0x800f,0x0000,0x7001},
  481.         {0x0003,0x8001,0xc000},
  482.         {0x0000,0xc003,0x0000},
  483.         {0x0000,0x2004,0x0000},
  484.         {0x0000,0x1818,0x0000},
  485.         {0x0000,0x0810,0x0000},
  486.         {0x0000,0x0420,0x0000},
  487.         {0x0000,0x0660,0x0000},
  488.         {0x0000,0x0240,0x0000}, /* Here is where                */
  489.         {0x0000,0x0180,0x0000}, /* the data                     */
  490.         {0x0000,0x0180,0x0000}, /* for more                     */
  491.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  492.         {0x0000,0x0180,0x0000}  /* follows                      */
  493.     },
  494.     {
  495.  
  496.         {0x0000,0x0000,0x0000}, /* Data for                     */
  497.         {0x0000,0x0000,0x0000}, /* Bob6. Only one               */
  498.         {0x0000,0x0000,0x0000}, /* BitPlane,                    */
  499.         {0x0000,0x0000,0x0000},
  500.         {0x0000,0x0000,0x0000},
  501.         {0x0000,0x0000,0x0000},
  502.         {0x0000,0x0000,0x0000},
  503.         {0x07e0,0x0000,0x07e0},
  504.         {0x3c3e,0x0000,0x7c3c},
  505.         {0x4003,0x8001,0xc001},
  506.         {0x0000,0x6006,0x0000},
  507.         {0x0000,0x300c,0x0000},
  508.         {0x0000,0x1818,0x0000},
  509.         {0x0000,0x0420,0x0000},
  510.         {0x0000,0x0660,0x0000},
  511.         {0x0000,0x03c0,0x0000}, /* Here is where                */
  512.         {0x0000,0x0180,0x0000}, /* the data                     */
  513.         {0x0000,0x0180,0x0000}, /* for more                     */
  514.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  515.         {0x0000,0x0180,0x0000)  /* follows                      */
  516.     },
  517.     {
  518.         {0x0000,0x0000,0x0000}, /* Data for                     */
  519.         {0x0000,0x0000,0x0000}, /* Bob7. Only one               */
  520.         {0x0000,0x0000,0x0000}, /* BitPlane.                    */
  521.         {0x0000,0x0000,0x0000},
  522.         {0x0000,0x0000,0x0000},
  523.         {0x0000,0x0000,0x0000},
  524.         {0x0000,0x0000,0x0000},
  525.  
  526.                 PAGE 488
  527.  
  528. -----------------------------------------------------------------------------
  529.  
  530.         {0x03fc,0x0000,0x3fc0},
  531.         {0x0c0f,0x8001,0xe030},
  532.         {0x1000,0xe007,0x0008},
  533.         {0x2000,0x6003,0x0004},
  534.         {0x2000,0x1818,0x0004},
  535.         {0x0000,0x0c60,0x0000},
  536.         {0x0000,0x0660,0x0000},
  537.         {0x0000,0x0240,0x0000},
  538.         {0x0000,0x0240,0x0000}, /* Here is where                */
  539.         {0x0000,0x0180,0x0000}, /* the data                     */
  540.         {0x0000,0x0180,0x0000}, /* for more                     */
  541.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  542.         {0x0000,0x0180,0x0000}  /* follows                      */
  543.     },
  544.     {
  545.         {0x0000,0x0000,0x0000}, /* Data for                     */
  546.         {0x0000,0x0000,0x0000}, /* Bob8. Only one               */
  547.         {0x0000,0x0000,0x0000}, /*BitPlane.                     */
  548.         {0x0000,0x0000,0x0000},
  549.         {0x0000,0x0000,0x0000},
  550.         {0x0000,0x0000,0x0000},
  551.         {0x0000,0x0000,0x0000},
  552.         {0x0000,0x0000,0x0000},
  553.         {0x0000,0x0000,0x0000},
  554.         {0x0lfe,0x0000,0x7f80},
  555.         {0x0301,0xc003,0x80c0},
  556.         {0x0400,0x6006,0x0020},
  557.         {0x0800,0x1818,0x0010},
  558.         {0x0800,0x0c30,0x0010},
  559.         {0x1000,0x0420,0x0008},
  560.         {0x1000,0x03c0,0x0008},
  561.         {0x1000,0x0180,0x0008), /* the data                     */
  562.         {0x0000,0x0180,0x0000}, /* for more                     */
  563.         {0x0000,0x0180,0x0000}, /* BitPlanes                    */
  564.         {0x0000,0x0180,0x0000}  /* would follow                 */
  565.         }
  566.     };
  567.  
  568. main()
  569. {
  570.     int i,j,k;
  571.     char*LeftMouse = (char*)0xBFE001;
  572.                     /* Left mouse button*/
  573.     if ((GfxBase = (struct GfxBase *)
  574.         OpenLibrary("graphics.library",0)) == NULL)
  575.         {
  576.            printf ("No Graphics !!!\n");
  577.            exit(0);
  578.         }
  579.  
  580.     if ((IntuitionBase = (struct IntuitionBase *)
  581.         OpenLibrary("intuition.library",0)) == NULL)
  582.         {
  583.            printf ("No Intuition !!!\");
  584.            goto cleanup2;
  585.         }
  586.  
  587.     if((Screen = (struct Screen *)
  588.         OpenScreen(&NewScreen)) == NULL)
  589.         {
  590.            printf ("No Screen !!!\n);
  591.            goto cleanup3;
  592.  
  593.                 PAGE 489
  594.  
  595. -----------------------------------------------------------------------------
  596.  
  597.         }
  598.  
  599.     BobBuffer = (UWORD*) AllocMem(MAXCOMPS*20*3*sizeof(UWORD), 
  600.                 MEMF_CLEAR | MEMF_CHIP);
  601.  
  602.     BobMask = (UWORD*) AllocMem(MAXCOMPS*20*3*sizeof(UWORD), 
  603.                 MEMF_CLEAR | MEMF_CHIP);
  604.  
  605.     Image = (UWORD*) AllocMem(MAXBOBS*20*3*sizeof(UWORD), 
  606.                 MEMF_CLEAR | MEMF_CHIP);
  607.  
  608.     if ((Image == 0) | (BobBuffer == 0) | (BobMask == 0))
  609.         {
  610.          printf ("No Chip Memory !!\n");
  611.          goto cleanup4;
  612.         }
  613.  
  614.     Help = Image;
  615.  
  616.     for (i=0; i<MAXBOBS;i++)
  617.         for (j=0;j<20;j++)
  618.         for (k=0;k<3;k++)
  619.             {
  620.             *Help = BobImage[i][j][k];
  621.             Help++;
  622.             }
  623.  
  624.     SetRGB4(&Screen->ViewPort,0,2,8,151); 
  625.     SetRGB4(&Screen->ViewPort,1,0,0,0,);
  626.  
  627.     SetRast (&RP,0);
  628.  
  629.     BltClear (&Start, sizeof(struct VSprite),0); 
  630.     BltClear (&Ende, sizeof(struct VSprite),0); 
  631.     BltClear (&GelsInfo, sizeof(struct GelsInfo),0); 
  632.     BltClear (BobsVSprite,
  633.         sizeof struct VSprite)*MAXCOMPS,0); 
  634.     BltClear (Bobs,
  635.         sizeof(struct Bob)*MAXCOMPS,0);
  636.     BltClear (AnimComp,
  637.          sizeof(struct AnimComp)*MAXCOMPS,0);
  638.  
  639.     BltClear (&Seagull, sizeof(struct AnimOb),0);
  640.  
  641. /*****************************************************************/
  642. /* A little Copper-Power                                         */
  643. /*****************************************************************/
  644.  
  645. UCopList = (struct UCopList *)
  646.     AllocMem (sizeof(struct UCopList),
  647.         MEMF_CHIP | MEMF_CLEAR);
  648.  
  649. CWAIT (UCopList,150,0);
  650. CMOVE (UCopList,custom.color[0]),0x000f);               /* Sea */
  651. CEND (UCopList);
  652.  
  653. Screen->ViewPort.UCopIns = UCopList;
  654.                     /* Copper list linked           */
  655. RemakeDisplay();                        /* and calculate new            */
  656.     
  657. /****************************************************************/
  658.    GelsInfo.sprRsrvd = 0xff;         /* All Sprites for VSprites*/
  659.  
  660.                 PAGE 490
  661.  
  662. -----------------------------------------------------------------------------
  663.  
  664.                      /* Memory for Gelinfo reserved */ 
  665.  
  666. GelsInfo.nextLine = (WORD *)AllocMem(sizeof (WORD)*8,
  667.         MEMF_PUBLIC | MEMF_CLEAR );
  668.  
  669. GelsInfo.lastColor = (WORD *)AllocMem(sizeof (LONG)*8, 
  670.         MEMF_PUBLIC | MEMF_CHIP);
  671.  
  672. GelsInfo.collHandler = (struct collTable *) 
  673.         AllocMem(sizeof (struct collTable),
  674.         MEMF_PUBLIC | MEMF_CLEAR);
  675.  
  676. if ((GelsInfo.nextLine == 0) | (GelsInfo.lastColor == 0) |
  677.     (GelsInfo.collHandler == 0))
  678.     {
  679.     printf (" No Memory for GelsInfo !!!\n");
  680.     goto cleanup5;
  681.     }
  682.  
  683.     GelsInfo.leftmost = 0;                  /* Boundary Collisions */        
  684.     GelsInfo.rightmost = 640;               /* Border collisions */       
  685.     GelsInfo.topmost = 0;
  686.     GelsInfo.bottommost = 200;
  687.  
  688.     InitGels(&Start, &Ende, &Gelsinfo);
  689.                         /* GelsInfo initialization */ 
  690.     RP.GelsInfo = &GelsInfo;                /* and in RastPort linked  */
  691.  
  692.     for (i=0; i<MAXBOBS; i++)
  693.         {
  694.         Bobs[il.BobVSprite = &BobsVSprite[i];
  695.         BobsVSprite[i].VSBob = &Bobs[i];
  696.         BobsVSprite[i].Width = 3;       /* All Bobs are       */
  697.         BobsVSprite[i].Height = 20;     /* the same size      */
  698.         BobsVSprite[i].Flags = SAVEBACK;
  699.                         /* Store background     */
  700.                         /* (in BobBuffer) and   */
  701.                         /* restore it at a time */ 
  702.         BobsVSprite[i].Depth = 1;
  703.                         /* Only one Plane per Bob */
  704.  
  705.                     /* BobsVSprite[i].ImageData */  
  706.                     /* initialised in extra loop*/
  707.  
  708.         BobsVSpriter[i].PlanePick = 1;
  709.                     /* Only first plane wriiten */
  710.                     /* to Rast Port             */
  711.  
  712.         BobsVSprite[i].PlaneOnOff=0;
  713.                     /* Remaining planes remain 0 */
  714.  
  715.         BobsVSprite[i].CollMask = BobMask+i*20*3; 
  716.         BobsVSprite[i].BorderLine = &BobBorderLine[i][0];
  717.                 /* Memory for CollMask and Borderline */
  718.                 /* prepared                           */
  719.  
  720.         Bobs[i].ImageShadow = BobMask+i*20*3;
  721.                 /* Shadow = CollMask                  */
  722.         
  723.         Bobs[i].Flags = BOBISCOMP;
  724.                 /* Bob is part of */
  725.         Bobs[i].BobComp=&AnimComp[i];
  726.                 /* this Animcomps       */
  727.  
  728.                    PAGE 491
  729.  
  730. -----------------------------------------------------------------------------
  731.  
  732.     Bobs[i].SaveBuffer = BobBuffer+i*20*3;
  733.                     /* Memory for SAVEBACK Option */
  734.  
  735.     BobsVSprite[i].Y = 0;        /* Position word is     */
  736.     BobsVSprite[i].X = 0;        /* calculated by the    */ 
  737.                     /* animation system!     */
  738.  
  739.     Bobs[i].Before = 0;        /* Priorities too!!!!!  */
  740.     Bobs[i].After = 0;
  741.  
  742.     InitMasks (&BobsVSprite[i]);
  743.             /* Initialise CollMask and BorderLine. */
  744.             /* (Memory must already be set aside!! */
  745.     }
  746.  
  747.     for (i=0; i<MAXBOBS; i++)
  748.         BobsVSprite[i].ImageData = Image+i*20*3;
  749.     for (i=MAXBOBS-2; i>0; i--)
  750.         BobsVSprite[MAXCOMPS[i].ImageData=
  751.                 Image+i*20*3;
  752.             /* Order the Bobs for             */
  753.             /* Sequence animation             */
  754.     for (i=0; i<MAXBOBS; i++)
  755.         {
  756.         AnimComp[i].AnimBob = &Bobs[i] ;
  757.         AnimComp[i].PrevComp = 0;     /* no further     */
  758.         AnimComp[i].NextComp = 0;     /* AnimComp in     */
  759.                         /* AnimOb     */
  760.         AnimComp[i].TimeSet = 3;    /* 3 mal Animate()     */
  761.                         /* before new sequence */
  762.                         /* is displayed.       */
  763.         AnimComp[i].Flags = RINGTRIGGER;
  764.                     /* Ring-Sequence-Animation     */
  765.         AnimComp[i].XTrans = 128*64;
  766.         AnimComp[i].YTrans = 0;
  767.                     /* Offset to AM/AnY in Seagull */
  768.                     /* Note: Fixed decimal ! ! !   */ 
  769.         AnimComp[i].AnimCRoutine = NULL; /* comp;            */
  770.                     /* no AnimComp Routine            */ 
  771.         AnimComp[i].HeadOb = &Seagull;
  772.                     /* HeadOb for AnimComp (for one */
  773.                     /* routine as intersection mark!)*/
  774.     }
  775.  
  776.     /*Sequence:         1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
  777.         /*Bobs/AnilComp:     1 2 3 4 5 6 7 8 9 6  5  4  3  2  */
  778.  
  779.     for (i=MAXBOBS-2; i>0; i--)
  780.         {
  781.         AnimComp[14-i].AnimBob = &Bobs[i];
  782.         AnimComp[14-i].PrevComp = 0;
  783.         AnimComp[14-i].NextComp = 0;
  784.         AnimComp[14-i].TimeSet  = 3;
  785.         AnimComp[14-i].Flags = RINGTRIGGER;
  786.         AnimComp[14-i].XTrans = 128*64;
  787.         AnimComp[14-i].YTrans = 0;
  788.         AnimComp[14-i].AnimCRoutine = NULL;     /* Comp; */
  789.         Bobs[14-i].BobComp = &AnimComp[14-i];
  790.         AnimComp[l4-i].HeadOb = &Seagull;
  791.              }                        /* see above */
  792.  
  793.     for (i=1; i<MAXCOMPS-1; i++)
  794.          {
  795.  
  796.                 PAGE 492
  797.  
  798. -----------------------------------------------------------------------------
  799.  
  800.     AnimComp[i].NextSeq = &AminComp[i+1];
  801.     AnimComp[i].PrevSeq = &AnimComp[i-1];
  802.             /8 intitialize 'Ring' for Ring/Sequence        */
  803.             /* Animation (PrevComp and NextComp remain    */
  804.             /* here without action and in this case        */
  805.             /* are not initialised, but set to 0        */
  806.     }
  807.  
  808.     AnimComp[0].NextSeq = &AnimComp[1];     /* Close ' Ring '       */
  809.     AnimComp[0].PrevSeq = &AnimComp[13];
  810.  
  811.     AnimComp[MAXCOMPS-1].NextSeq = &AnimComp[0];
  812.     AnimComp[MAXCOMPS-1].PreqSeq = &AnimComp[12];
  813.  
  814.     Seagull.HeadComp   = &AnimComp[0];    /* Animobs first     */
  815.                         /* AnimComp        */
  816.     Seagull.RingXTrans = 2*64;        /* X/Y Translation      */
  817.       Seagull.RingYTrans = 1*64;        /* of seagull        */
  818.     Seagull.AnX = 0;            /* start position       */
  819.     Seagull.AnY = 0;            /* of XTrans        */
  820.     Seagull.XAccel = 0x0000;        /* has no movement      */
  821.     Seagull.YAceel = 0x0000;        
  822.     Seagull.XVel =    0x0000;            /* no movement speed    */
  823.     Seagull.YVel =    0x0000;
  824.     Seagull.AnimORoutine    =    MoveSeagull;
  825.                         /* User control    routine    */
  826.  
  827.     AddAnimOb(&Seagull,&HeadOb,&RP);
  828.                         /* Animob in list    */
  829.     while (&LeftMouse & 0x40) == 0x40)
  830.         {
  831.         Animate(&HeadOb,&RP);        /* Sort            */
  832.         SortGList(&RP) ;        /* Animation        */
  833.         WaitTOF();    /* to prevent blinking the bobs!    */
  834.         DrawGList(&RP, &Screen->ViewPort);    /* Draw        */
  835.         }
  836.                 /* GelsInfo's memory freed */
  837.  
  838.     cleanup5:
  839.     if (GelsInfo.nextLine != 0)
  840.         FreeMem(GelsInfo.nextLine, sizeof(WORD)*8);
  841.     if (GelsInfo.lastColor != 0)
  842.         FreeMem (GelsInfo.lastColor, sizeof(LONG)*8);
  843.     if (GelsInfo.collHandler != 0)
  844.         FreeMem (GelsInfo.collHandler,
  845.              sizeof(struct collTable));
  846.  
  847.      cleanup4:
  848.      if (Image != 0)
  849.         FreeMem(Image,MAXBOBS*20*3*sizeof(UWORD));
  850.      if (BobBuffer != 0)
  851.         FreeMem(BobBuffer,MAXCOMPS*20*3*sizeof(UWORD)); 
  852.          if (BobMask != 0)
  853.         FreeMem(BobMask, MAXCOMPS*20*3*sizeof(UWORD));
  854.  
  855.      cleanup3:    CloseScreen(Screen);
  856.      cleanup2:    CloseLibrary(IntuitionBase);
  857.      cleanup1:    CloseLibrary(GfxBase);
  858.     }
  859.  
  860.     /*****************************************************************/
  861.     /* This function is called each time by Animate()          */
  862.     /*---------------------------------------------------------------*/
  863.  
  864.                 PAGE 493
  865.  
  866. -----------------------------------------------------------------------------
  867.  
  868.     /* Input parameter : AnimOb-Structure, animated with         */
  869.     /*              Animate(). These parameters are         */
  870.     /*             passed by Animate()             */
  871.     /*--------------------------------------------------------------*/
  872.     /* Returnvalue     : none                     */
  873.     /****************************************************************/
  874.     
  875.     WORD MoveSeagull (Object)
  876.     struct AnimOb *Object;
  877.     {
  878.         if ((Object->AnX < (-128*64)) ||    /* 1st user object */
  879.         (Object->AnX > ((512-48)*64)))         /* corner?        */
  880.         Object->RingXTrans *= -1;
  881.  
  882.         if ((Object->AnY < (0)) ||
  883.         (Object->AnY > (120*64)))
  884.         Object->RingYTrans *= -1;
  885.     }
  886.  
  887.     /*****************************************************************/
  888.     /* This function is called each time by Animate()          */
  889.     /*---------------------------------------------------------------*/
  890.     /* Input parameter : AnimOb-Structure, animated with          */
  891.     /*             Animate(). These parameters are              */
  892.     /*             passed by Animate()              */
  893.     /*---------------------------------------------------------------*/
  894.     /* Returnvalue     : none                      */
  895.     /*****************************************************************/
  896.     /* WORD Comp(Component)
  897.     struct AnimComp *Component;
  898.     {
  899.         return(0);
  900.     } */
  901.  
  902.                 PAGE 494
  903.  
  904. -----------------------------------------------------------------------------
  905.  
  906. 19. Copper Programming in C
  907.  
  908. As you already know from the previous chapters, the Copper is a coprocessor 
  909. of the Amiga. It is responsible for the visible display, which means that 
  910. it determines what appears at a specific position of the electronic beam.
  911.  
  912. The Copper also helps display sprites and vsprites However, a more 
  913. important feature of the Copper is that it can be programmed by the user. 
  914. Simply insert a pointer to the user Copper list (struct UCopLiSt 
  915. *UserCopperList), which uses the Copper instructions to program the Copper.
  916.  
  917. However, before you can use this you must assign enough memory for 
  918. your user Copper list: UserCopperList = (struct UCopList *) AllocMem(sizeof 
  919. (struct UCopIns), MEMF_PUBLIC | MEMF_CLEAR).
  920.  
  921. You must clear the memory for this structure. Do this either directly 
  922. with AllocMem through the MEMF-CLEAR option, or afterwards with BltClear. 
  923. This allows the entry of new Copper instructions and then tells MakeVPort 
  924. that the user Copper list is still empty.
  925.  
  926. Now that we have explained all the preliminary steps, we can proceed to the 
  927. Copper language. It is very simple and concise of only three instructions, 
  928. CMOVE, CWAIT and CEND. These three instructions are all that is needed 
  929. to program pull down Intuition screens.
  930.  
  931. The CMOVE instruction enables you to write a value into a specific hardware 
  932. register (see Appendix C). Both the hardware register and the value are 
  933. specified by you with the Custom structure, which allows you to access the 
  934. hardware registers. To create this structure first use extern struct Custom 
  935. custom and then use custom.<Registername> to access the individual 
  936. hardware registers.
  937.  
  938. Now give the CMOVE instruction as a parameter and, as you may have assumed, 
  939. the absolute address of the desired hardware register. The Copper only 
  940. works with offsets of the registers from $DF000 and CMOVE calculates the 
  941. absolute address for you.
  942.  
  943. You must provide a pointer to this structure beforehand so that the CMOVE 
  944. instruction also knows where to find the user Copper list.
  945.  
  946.                 PAGE 495
  947.  
  948. -----------------------------------------------------------------------------
  949.  
  950. Now you must supply the 16 bit value (Word) that will be wrilten into
  951. the desired hardware register.
  952.  
  953. A complete call with the CMOVE instruction would look like this:
  954.     
  955.     CMOVE (UserCopperList, Custom.<RegisterName>, Value);
  956.  
  957. There is a small restriction you should remember when using the    CMOVE 
  958. instruction. Usually you can write to any hardware register numbered higher 
  959. than $20 (dskpt) without any limitations. However, you cannot under any 
  960. circumstances, address register numbers smaller    than $10 (adkconr) through 
  961. the Copper. It is possible to write only to registers that fall between $10 
  962. and $20 after you have set the Copper DangerBit in register (copcon) 
  963. (number $2E).
  964.  
  965. When discussing sprite collision detection, we explained how you 
  966. access the hardware registers with help from the 68000. Review that
  967. section if necessary.
  968.  
  969. Another Copper instruction is CWAIT. This instruction enables you to    
  970. wait for the electronic scanning beam to reach a specific position. The
  971. user Copper list doesn't perform any other instructions until the
  972. scanning beam reaches the specified position (The Copper program
  973. won't have any effect on your C program). For example, you could wait 
  974. for any desired position and change the contents of one of the color
  975. registers. You could also use this technique to display one of your
  976. sprites beginning in the middle of the screen.
  977.  
  978. When you use the CWAIT instruction you must tell the user Copper list 
  979. where your instructions will be located. You must also provide the X and 
  980. Y position that the electronic beam should wait for. The order of the X and 
  981. Y coordinates is very important. First specify the Y coordinate and then 
  982. the X coordinate. Pay close attention to the order of these coordinates 
  983. because using them out of sequence can be very frustrating. Your Copper 
  984. program will not function properly if the Y coordinate isn't first.
  985.  
  986. CWAIT (&UserCopperList,Y,X) lets you wait for a specific electronic beam 
  987. position. Remember that the Y position must be smaller than 263 and the X 
  988. position must be smaller than 223. Also, you must set the Y position 
  989. relative to the top of your ViewPort and the X position relative to the 
  990. normal scanning position. This means that for the X position you have to 
  991. consider Overscan. The electronic beam actually covers a much larger area 
  992. than is visible on the screen. A good value to use for positioning the 
  993. electronic beam at The left ViewPort border is X=60 plus or minus 2 or 
  994. View.DxOffset/2 plus or minus one.
  995.  
  996.                 PAGE 496
  997.  
  998. -----------------------------------------------------------------------------
  999.  
  1000. So that the Copper program ends properly, we use the CEND instruction. 
  1001. The only parameter needed is the user Copper list that will be ending. 
  1002. CEND (&UserCopperList) waits for the electronic beam to reach row position 
  1003. 10000 and column position 256. Since this position is never reached, 
  1004. the user Copper list is no longer used.
  1005.  
  1006. When the electronic beam reaches the bottom of the screen, it will start at 
  1007. the top row again (Top Of Frame). All Copper lists for the ViewPorts and the 
  1008. user Copper Iist are run again.
  1009.  
  1010. The Copper can perform raster row interrupts similar to the ones from the 
  1011. Commodore 64. However, unlike the Commodore 64, the Copper can also change 
  1012. a color in the middle of a raster row. Remember that each CMOVE instruction 
  1013. requires a maximum resolution of 8 pixels. This means that with a normal 
  1014. resolution, a CMOVE instruction can only by performed every 8 pixels. 
  1015. Therefore, between two consecutive CMOVE instructions there must be an 8 
  1016. pixel gap.
  1017.  
  1018. The CwAIT instruction allows you to wait for electronic beam positions that 
  1019. are spaced only 4 pixels apart. However, When a CMOVE instruction follows a 
  1020. CWAIT instruction, an 8 pixel gap is still required.
  1021.  
  1022. After using the above instruction to create your user Copper list, you must 
  1023. provide this information to the ViewPort that will use the list. To do this 
  1024. use ViewPort.UCopIns = UserCopperList. When using Intuition screens, use the 
  1025. following form, Screen>ViewPort.UCopIns = &UserCopperList.
  1026.  
  1027. Now open your own screens by calling MakeVPort and MrgCop.
  1028.  
  1029. Intuition screens are handled differently. OpenScreen generates the Copper 
  1030. list for the screen. Afterwards, use RemakeDisplay to ensure that the new 
  1031. user Copper list is added to the global View Copper list.
  1032.  
  1033. FreeVPortCprList and CloseScreen release the dynamically reserved memory for 
  1034. the UCopList, a two word pointer that contains your instructions. No 
  1035. additional instructions, such as FreeMem need to be executed. Make sure you 
  1036. declare your user Copper list as a pointer and reserve the required memory 
  1037. for the UCopList structure in your program. FreeVPortCprList and CloseScreen 
  1038. free the memory for not only the instruction list, but (also for the 
  1039. UCopList Structure.
  1040.  
  1041. When you declare the UCopList as a normal structure, the memory that it uses 
  1042. is released twice. It is released first by FreeVportCopLists and then by 
  1043. your program, which ends by
  1044.  
  1045.                 PAGE 497
  1046.  
  1047. -----------------------------------------------------------------------------
  1048.  
  1049. returning all used memory areas to the system. This double release of one 
  1050. memory area causes the familiar Guru Meditations.
  1051.  
  1052. To avoid this, always declare your UCopList as a pointer that is later used 
  1053. to assign your memory.
  1054.  
  1055. Finally, another small tip: To change your Copper list in your program you 
  1056. must clear your reserved UCopList structure (BltClear is best) and build a 
  1057. new list.
  1058.  
  1059. /***********************************************************************/
  1060. /*                 Copper. c                   */
  1061. /*                                       */
  1062. /* This Program demonstrates how you can access the               */
  1063. /* AMIGA Hardware-Registers with Help from the Copper.                 */
  1064. /* Compiled with: Aztec C 3.6a                           */
  1065. /* cc +L -s Copper.c                               */
  1066. /* ln Copper.0 -lc32                               */
  1067. /* (c) Bruno Jennrich                               */
  1068. /***********************************************************************/
  1069.  
  1070. #include    "exec/types.h"
  1071. #include    "exec/nodes.h"
  1072. #include    "exec/memory.h"
  1073. #include    "graphics/gfx.h"
  1074. #include    "graphics/gfxmacros.h"
  1075. #include    "graphics/gfxbase.h"
  1076. #include    "graphics/text.h"
  1077. #include    "graphics/regions.h"
  1078. #include    "graphics/clip.h"
  1079. #include    "graphics/view.h"
  1080. #include    "graphics/copper.h"
  1081. #include    "graphics/gels.h"
  1082. #include    "hardware/blit.h"
  1083. #include    "hardware/custom.h"
  1084.  
  1085. #define WIDTH 320
  1086. #define HEIGHT 200
  1087.    /* PAL 256 HERE */
  1088.  
  1089. #define MODES 0
  1090.  
  1091. struct    View View;
  1092. struct    ViewPort ViewPort;
  1093. struct    RasInfo RasInfo;
  1094. struct    BitMap BitMap;
  1095. struct    RastPort RastPort;
  1096.  
  1097. struct GfxBase *GfxBase;
  1098.  
  1099. struct View *oldview;
  1100.  
  1101. struct UCopList *UserCopperList;         /* our Copper List */
  1102. extern struct ColorMap *GetColorMap();
  1103. /* extern struct Custom custom; in custom.h */
  1104.                         /* For Access to the */
  1105.                         /* Hardware-Register */
  1106.  
  1107.                 PAGE 498
  1108.  
  1109. -----------------------------------------------------------------------------
  1110.     
  1111. UWORD Colors[16l = {
  1112.         0x000,0x0bbd,0x0f0,0xf00,
  1113.         0x123,0x435,0x678,0x009,
  1114.         0x123,0x435,0x678,0x009,
  1115.         0x123,0x435,0x678,0x009
  1116.         };
  1117.                     /* Own ColorMap.    */
  1118.                     /* Color reg. 1 is      */
  1119.                     /* changed by the       */
  1120.                     /* Copper        */
  1121.     
  1122. char *LeftMouse = (char *)0xbfe001;
  1123.  
  1124. char *Texts[15] = {"COPPER-Programming with the AMIGA",
  1125.         "";
  1126.         "The SPECIAL-EFFECTS Processor in Action";
  1127.         "";
  1128.         "";
  1129.         "Colors underneath the Text";
  1130.         "(a standard feature of Games)",
  1131.         "and how it is done.";
  1132.         "";
  1133.         "";
  1134.         "";
  1135.         "This Effect is especially spectacular";
  1136.         "when used with Moving BOBS !";
  1137.         "";
  1138.         "(MOUSE BUTTON)};
  1139.  
  1140. /**************************************************************/
  1141. /* Here we go !                           */
  1142. /**************************************************************/
  1143.  
  1144. main()
  1145. {
  1146.     long i,Len;
  1147.     if ((GfxBase = (struct GfxBase *)
  1148.         Open Library ("graphics.library",0)) == NULL )
  1149.         {
  1150.          printf (" No Graphics !!!\n");
  1151.          Exit(10);
  1152.         }
  1153.  
  1154.     oldview = GfxBase->ActiView;         /* Build a Screen as */
  1155.  
  1156.     InitView(&View);            /* usual         */
  1157.     InitVPort(&ViewPort);
  1158.  
  1159.     View.Modes = MODES;
  1160.     View.ViewPort = &ViewPort;
  1161.     ViewPort.DWidth = WIDTH;
  1162.     ViewPort.DHeight = HEIGHT;
  1163.     ViewPort.Modes = MODES;
  1164.  
  1165.     RasInfo.RyOffset = 0;
  1166.     RasInfo.RxOffset = 0;
  1167.     RasInfo.Next = 0;
  1168.  
  1169.     ViewPort.RasInfo = &RasInfo;    
  1170.     ViewPort.ColorMap = GetColorMap(l6);
  1171.  
  1172.                 PAGE 499
  1173.  
  1174. -----------------------------------------------------------------------------
  1175.     
  1176.     LoadRGB4 (GViewPort, &Colors, 16) ;
  1177.  
  1178.     InitBitMap(@BitMap, 4, WIDTH, HEIGHT);
  1179.     for (i=0; i<4; i++)
  1180.         
  1181.         Bitmap.Planes[i].(PLANEPTR)
  1182.             AllocRasteR(WIDTH,HEIGHT);
  1183.         if (BitMap.Planes[i] == NULL)
  1184.         {
  1185.                   printf("No BitMap - Space !!!\n");
  1186.           Exit(0);
  1187.         }
  1188.  
  1189.     InitRastPort(&RastPort);
  1190.  
  1191.     RastPort.BitMap = &BitMap;
  1192.     RasInfo.BitMap = &BitMap;
  1193.  
  1194.     SetRast (&RastPort,0);
  1195.  
  1196.     SetAPen (&RastPort,1);
  1197.  
  1198.     for (i=0;i<17;i++)
  1199.         {
  1200.         Len = WIDTH/2-
  1201.         TextLength(&RastPort,Texts[i], strlen(Texts[i]))/2;
  1202.  
  1203.         Move (&RastPort, Len,i*9+63+RastPort.TxBaseline);
  1204.  
  1205.         /* Y-Coordinate should be divisible by 9 ! */
  1206.  
  1207.         Text (&RastPort,Texts[i],strlen(Texts[i]));
  1208.  
  1209.         MakeVPort(&View,@ViewPort);     /* Display ViewPort. */     
  1210.         MrgCop(&View);             /* Makes the difference */
  1211.         LoadView(&View);        /* visible.    */
  1212.  
  1213.         UserCopperList = (struct UCopList *)
  1214.             AllocMem(sizeof (struct UCopList),MEMF_CHIP); 
  1215.                 /* Reserve the required Memory */
  1216.                 /* for the UCopList-Structure  */
  1217.  
  1218.         BltClear(UserCopperList, sizeof(struct UCopList),0);
  1219.                 /* Clear UCopList-Structure */
  1220.         for (i=0; i<256; i+=9)
  1221.         {
  1222.           CWAIT (UserCopperList,i,view.DxOffset/2);
  1223.           CMOVE (UserCopperList,custom.color[1],0x0fff);
  1224.                             /* white */
  1225.  
  1226.           CWAIT (UserCopperList,i+3,view.DxOffset/2);
  1227.           CMOVE (UserCopperList,custom.color[1],0x0bbd);
  1228.                             /* light purple */
  1229.  
  1230.           CWAIT (UserCopperList,i+5,View.DxOffset/2); 
  1231.           CMOVE (UserCopperList,custom.color[1],0x088b);
  1232.                             /* purple */
  1233.  
  1234.           CWAIT (UserCopperList,i+7,View.DxOffset/2);
  1235.           CMOVE (UserCopperList,custom.color[1],0x0558);
  1236.                             /* dark purple */
  1237.         }
  1238.  
  1239.                 PAGE 500
  1240.  
  1241. -----------------------------------------------------------------------------
  1242.  
  1243.         CEND (UserCopperList );            /* End UCopList */
  1244.  
  1245.         Delay (100);                /* Wait 2 Seconds */
  1246.  
  1247.         ViewPort.UCopIns = UserCopperList;
  1248.                         /* Link ViewPort and UCopList */
  1249.  
  1250.         MakeVPort (&View,&ViewPort);
  1251.             /* Calculate ViewPort Copper-List */ 
  1252.             /* with a Intuition Screen using  */
  1253.             /* RethinkDisplay()          */
  1254.     
  1255.         MrgCop(&View);
  1256.         LoadView(&View);
  1257.  
  1258.         while ((*LeftMouse @ 0x40) == 0x40);
  1259.             /* Wait for Mouseclick */ 
  1260.         LoadView (oldview);
  1261.  
  1262.         for (i=0; i<4; i++)
  1263.             FreeRaster (BitMap.Planes[i],WIDTH, HEIGHT);
  1264.  
  1265.         FreeColorMap(ViewPort.ColorMap);
  1266.  
  1267.         FreeVPortCopLists(&ViewPort);
  1268.                 /* UCopList automatically released */
  1269.  
  1270.         FreeCprList(View.LOFCprList);    
  1271.         FreeCprList(View.SHFCprList);
  1272.                 /* View-Copper List FREE */
  1273.  
  1274.         CloseLibrary(GfxBase);
  1275.         return (0);
  1276.        }
  1277.                 PAGE 501
  1278.  
  1279. --------------------------------------------------------------------------
  1280.  
  1281.                   APPENDIX A: STRUCTURE AND INCLUDE FILES.
  1282.  
  1283. This appendix contains a listing of all symbolic constants (#define xyz
  1284. numerical value) and the include file in which these constants are
  1285. located. Also listed are all used structures (struct) and all used C 
  1286. macros (#define xyz()). At the end of this appendix we explain the structure
  1287. functions and provide more details for the most important structure 
  1288. details.
  1289.  
  1290.  
  1291.     Declaration             Include File.
  1292.  ------------------------------     ----------------------------------
  1293.     struct AnimOb            "graphics/gels.h"
  1294.     struct AnimComp            "graphics/gels.h"
  1295.     struct AreaInfo             "graphics/rastport.h"
  1296.     #define AREAOUTLINE        "graphics/rastport.h"
  1297.     struct AvailFonts        "libraries/diskfont.h"
  1298.     struct AvailFontsHeader     "libraries/diskfont.h"
  1299.     struct BitMap            "graphics/gfx.h"
  1300.     struct Bob            "graphics/gels.h"
  1301.     #define BNDRYOFF()          "graphics/gfxmacros.h"
  1302.     #define BOBISCOMP        "graphics/gels.h"
  1303.     #define BOBSAWAY        "graphics/gels.h"
  1304.     #define BOTTOMHIT        "graphics/collide.h"
  1305.     #define CEND0            "graphics/gfxmacros.h"
  1306.     #define CMOVE0            "graphics/gfxmacros.h"
  1307.     struct ColorMap            "graphics/view.h"
  1308.     #define COMPLEMENT         "graphics/rastport.h"
  1309.     struct Custom            "hardware/custom.h"
  1310.     #define CUSTOMBITMAP        "intuition/intuition.h"
  1311.     #define CUSTOMSCREEN        "intuition/intuition.h"
  1312.     #define CWAIT0            "graphics/gfxmacros.h"
  1313.     struct DBuffPacket        "graphics/gels.h"
  1314.     #define DUALPF            "graphics/view.h"
  1315.     #define EXTRA_HALFBRITE        "graphics/view.h"
  1316.     struct GelsInfo            "graphics/gels.h"
  1317.     #define GELGONE            "graphics/gels.h"
  1318.     struct GfxBase            "graphics/gfxbase.h"
  1319.     #define HAM            "graphics/view.h"
  1320.     #define HIRES            "graphics/view.h"
  1321.     #define INVERSVID        "graphics/rastport.h"
  1322.     struct IntuitionBase         "intuition/intuitionbase.h"
  1323.     struct IntuiMessage        "intuition/intuition.h"
  1324.     
  1325.                 PAGE 503
  1326.  
  1327. ---------------------------------------------------------------------------
  1328.  
  1329.     #define JAM1            "intuition/intuition.h"
  1330.     #define JAM2            "intuition/intuition.h"
  1331.     #define LACE            "graphics/view.h"
  1332.     #define LEFTHIT            "graphics/collide.h"
  1333.     struct NewScreen        "intuition/intuition.h"
  1334.     struct NewWindow        "intuition/intuition.h"
  1335.     #define MEMF_CHIP        "exec/memory.h"
  1336.     #define MEMF_PUBLIC        "exec/memory.h"
  1337.     struct Menu            "intuition/intuition.h"
  1338.     struct MenuItem            "intuition/intuition.h"
  1339.     #define OVERLAY            "graphics/gels.h"
  1340.     #define PFBA            "graphics/view.h"
  1341.     #define RASSIZE()               "graphics/gfx.h"
  1342.     struct RasInfo            "graphics/view.h"
  1343.     struct Rastport            "graphics/viewport.h"
  1344.     #define RemBob()        "graphics/gels.h"
  1345.     #define RINGTRIGGER        "graphics/gels.h"
  1346.     #define RIGHTHIT        "graphics/collide.h"
  1347.     struct Screen            "intuition/intuition.h"
  1348.     #define SAVEBACK        "graphics/gels.h"
  1349.     #define SAVEBOB            "graphics/gels.h"
  1350.     #define SUSERFLAGS        "graphics/gels.h"
  1351.     #define SELECTDOWN        "intuition/intuition.h"
  1352.     #define SELECTUP        "intuition/intuition.h"
  1353.     #define SetOPen()        "graphics/gfxmacros.h"
  1354.     #define SetDrPt()        "graphics/gfxmacros.h"
  1355.     #define SetWrMsk()        "graphics/gfxmacros.h"
  1356.     #define SetAfPt()        "graphics/gfxmacros.h"
  1357.     struct SimpleSprite        "graphics/sprite.h"
  1358.     #define SPRITE_ATTACHED        "graphics/sprite.h"
  1359.     struct TextAttr            "graphics/text.h"
  1360.     struct TextFont            "graphics/text.h"
  1361.     struct TmpRas            "graphics/rastport.h"
  1362.     #define TOPHIT            "graphics/collide.h"
  1363.     struct UCopList            "graphics/copper.h"
  1364.     typedef ULONG            "exec/types.h"
  1365.     typedef UWORD            "exec/types.h"
  1366.     struct View            "graphics/view.h"
  1367.     struct ViewPort            "graphics/view.h"
  1368.     #define VP_HIDE            "graphics/view.h"
  1369.     struct VSprite            "graphics/gels.h"
  1370.     #define WBENCHSCREEN        "intuition/intuition.h"
  1371.     struct Window            "intuition/intuition.h"
  1372.     
  1373.                 PAGE 504
  1374.     
  1375. -----------------------------------------------------------------------------
  1376.  
  1377. struct AnimComp
  1378.     {
  1379.     WORD Flags;
  1380.         THese variables enable you to determine the type of 
  1381.         animation to use. When you set the RINGTRIGGER flag it
  1382.         means you have set up a ring of ANIMCOMPS. You link the 
  1383.         ring through the AnimComp.NextSeq and AnimComp.PrevSeq.
  1384.         Animate can automatically display different sequences 
  1385.         (like a flying bird) by using the AnimComp ring.
  1386.     
  1387.         Unless you set RINGTRIGGER, animation is not possible.
  1388.  
  1389.     WORD Timer;
  1390.         This variable is loaded with the timeset variable and 
  1391.         decremented (if set to decrement to zero) with each
  1392.         Animate() call. Whenver Timer reaches zero, depending on 
  1393.         your setup (RINGTRIGGER), a new sequence is displayed.
  1394.  
  1395.     WORD TimeSet;
  1396.         The value contained here is written into Time and 
  1397.         decremented there by every Animate() call. TimeSet 
  1398.         determines how long an animnation sequence is active. The
  1399.         next sequence starts after a certain number of Animate()
  1400.         calls.
  1401.  
  1402.     struct AnimComp *NextComp;
  1403.     struct AnimComp *PrevComp;
  1404.         These two variables allow you to link many animation 
  1405.         objects (AnimOb) together for display by Animate(). For
  1406.         example, the AnimObs for the arms, legs and head of a man
  1407.         can be linked together. Please remember that NextComp and
  1408.         PrevComp should not be used to animate a sequence for 
  1409.         moving an arm while walking. You must use NextSeq and
  1410.         PrevSeq for these type of animations.
  1411.  
  1412.     struct AnimComp *NextSeq;
  1413.     struct AnimComp *PrevSeq;
  1414.         When you want to repeatedly change an animation component
  1415.         define different display (sequences) of an object (for 
  1416.         example, an arm). Then use the above two pointers to tell
  1417.         Animate() that you want the arm displayed in different 
  1418.         positions. You program the various arm movement positions 
  1419.         and then they are displayed.
  1420.  
  1421.     WORD (*AnimCRoutine)();
  1422.         You either set this pointer to zero or point it to a 
  1423.         function you have defined. Each call of Animate() that
  1424.         displays your components also calls this function. Your
  1425.         routine is passed to the current AnimComp structure.
  1426.     
  1427.                 PAGE 505
  1428.     
  1429. -----------------------------------------------------------------------------
  1430.  
  1431.     WORD YTrans, XTrans;
  1432.         These two pointers contain the position of the AnimComps
  1433.         relative to the AnimObs defined earlier. (Please remember
  1434.         to use the fixed decimal arithmetic for these variables).
  1435.  
  1436.     struct AnimOb *HeadOb;
  1437.         This pointer points to the previously defined AnimOb of 
  1438.         which the AnimComp is a part.
  1439.  
  1440.     struct Bob *AnimBob;
  1441.         Naturally Animate() must also know what should be 
  1442.         displayed. For this purpose the AnimComp structure contains
  1443.         a pointer to the bob this is associated with the AnimComp.
  1444.         (Please make sure that the bob also has its own VSprite 
  1445.         structure).
  1446.     
  1447.     }
  1448.     
  1449. The AnimComp, or the animation components, determine the connection between
  1450. bob and animation object (AnimOb). This is especially important with 
  1451. Sequence Animation (RINGTRIGGER) because it connect the individual 
  1452. components together in a ring and sets the amount of time each sequence is
  1453. active.
  1454.     
  1455.     
  1456.         -------------------------------------------------------
  1457.  
  1458.  
  1459. struct AnimOb
  1460.     {
  1461.     struct AnimOb *NextOb *PrevOb;
  1462.         The variables mkae it possible for you to link many 
  1463.         animation object together. The linked objects are then 
  1464.         animated with Animate() and then with SortGList(). 
  1465.         DrawGList() etc are all displayed on the screen (for 
  1466.         example several men).
  1467.  
  1468.     LONG Check;
  1469.         This variable contains a count of the calls to Animate()
  1470.         that have been used for an AnimOb.
  1471.  
  1472.     WORD AnOldY AnOldX;
  1473.         These variables contain the old position of an animation
  1474.         object. We save the old position because the current 
  1475.         position (AnX, AnY) does not change until timer reaches
  1476.         zero for the current AnimComp. The user can change the 
  1477.         position between movements which causes some components to
  1478.         be displayed in the wrong positions. For this reason, we 
  1479.         store the old position. After numerous Animate() calls the
  1480.         actual position is calculated using the old position and 
  1481.         the following variables.
  1482.  
  1483.     WORD AnX, AnY;
  1484.         These variables contain the actual positions of the AnimObs.
  1485.         They do not contain values for pixel and row positions 
  1486.         within a RastPort. Depending on the speed and motion 
  1487.         variables, they contain values in steps of 64 for pixels 
  1488.         and lines.
  1489.  
  1490.                 PAGE 506
  1491.     
  1492. -----------------------------------------------------------------------------
  1493.  
  1494.         This means you must use AnX = Width/2 * 64 and
  1495.         AnY = Height/2 * 64 to move AnimOb to the middle of the
  1496.         screen. Again we have a problem using horizontal values 
  1497.         plus or minus 32768 versus positions over 512 (=32768/64).
  1498.         The following trick can help: The variable XTrans (and 
  1499.         YTrans) in the AnimComp structure set the position of an
  1500.         AnimComp relative to the previously defined AnimOb. When 
  1501.         you simply initialise XTrans with a value of 128*64 you 
  1502.         can move an object around the entire screen (512+128 = 640)
  1503.         even in hires mode.  For horizontal values less than 128
  1504.         you simply use negative values with AnX.
  1505.  
  1506.     WORD YVel, XVel;
  1507.         The speed of an AnimOb is contained in these two variables.
  1508.         The values in YVel and XVEL and added to AnY and AnX 
  1509.         after every Animate() call. Because Animate() is normally
  1510.         called many timed per second it is possible for your object
  1511.         to move erratically on the screen. To prevent this, 
  1512.         velocity and acceleration are set using step values of 64
  1513.         for every Animate() (this is the reason for the unusual 
  1514.         method used for the values in AnX and AnY). This means that
  1515.         with a value of one in XVel, 64 Animate calls have to 
  1516.         occur before the object moves one pixel.
  1517.  
  1518.     WORD YAccel, XAccel;
  1519.         These variables determine the motion of your AnimOb. These
  1520.         variables must also be set in steps of 64. The values in 
  1521.         XAccel and YAccel are added to XVel and YVel.
  1522.  
  1523.     WORD RingYTrans, RingXTrans;
  1524.         These variables set the speed of the AnimOb. They are added
  1525.         directly to AnX and AnY. Motion isn't a factor here.
  1526.  
  1527.     WORD (*AnimORoutine) ();
  1528.         The routine whose addres is specified here is called once
  1529.         by every Animate() call. This routine is passed to the 
  1530.         current AnimOb stucture so that the actual position of the 
  1531.         current AnimOb is controlled and the proper reaction is
  1532.         received.
  1533.  
  1534.     struct AnimComp *HeadComp;
  1535.         This pointer points to the first animation component of an
  1536.         AnimOb.
  1537.  
  1538.     AUserStuff AUserExt;
  1539.         Link your own structures (see VSPRite, VUserStuff) here.
  1540.     
  1541.     }
  1542.  
  1543. The AnimOb structure contains a complete animation object. You use
  1544. AddAnimOb() to make this structure available to the system and then use
  1545. Animate() for animation.
  1546.     
  1547.                 PAGE 507
  1548.     
  1549. -----------------------------------------------------------------------------
  1550.  
  1551. struct AvailFonts
  1552.     {
  1553.     OWORD af_Type;
  1554.         These variables determine whether the TextAttr structure 
  1555.         specified below uses a font in memory (AFF_MEMORY) or a 
  1556.         diskfont in the "SYS:fonts" directory (AFF_DISK). This is
  1557.         important for determining whether you should use OpenFont()
  1558.         or OpenDiskFont() to open a font.
  1559.  
  1560.     struct TextAttr af_Attr;
  1561.         This is the TextAttr structure returned by AvailFonts().
  1562.     
  1563.      }
  1564.  
  1565. This structure is only used by the routine AvailFonts() (and by you, of 
  1566. course). It is written after the AvailFontsHeader is located in a memory 
  1567. area where it is available for use by AvailFonts().
  1568.     
  1569.     
  1570.         --------------------------------------------
  1571.  
  1572. struct AreaInfo
  1573.  
  1574. This structure is required for the Area function. It is initialised with
  1575. InitArea and used for the coordinates of a polygon corner points.
  1576.  
  1577.         --------------------------------------------
  1578.  
  1579. struct AvailFontsHeader
  1580.  
  1581. This structure can only be created by using the routine AvailFonts() and
  1582. contains only one variable: afh_NumEntries. This variable contains the 
  1583. count of the AvailFonts structures written after the AvailFontsHeader in 
  1584. the memory area specified by the AvailFonts() routine.
  1585.     
  1586.         --------------------------------------------
  1587.  
  1588. struct BitMap
  1589.     {
  1590.     UWORD BytePerRow;
  1591.         This variable contains the byte count required for one 
  1592.         bitmap row (BytesPerRow = Width/8).
  1593.  
  1594.     UWORD Rows;
  1595.         The line count for a bitmap (height) is contained in this
  1596.         variable.
  1597.     
  1598.     UWORD Flags;
  1599.         This variable is only used by the system.
  1600.     
  1601.                 PAGE 508
  1602.  
  1603. -----------------------------------------------------------------------------
  1604.  
  1605.     UBYTE Depth;
  1606.         The number of bitplanes in a bitmap are contained in this
  1607.         variable. Please remember that the depth determines the 
  1608.         number of available colours (colors = 2^NumBitPlanes).
  1609.  
  1610.     UWORD    pad;
  1611.         This is one full WORD so the following pointer begins with
  1612.         a LONG WORD address.
  1613.  
  1614.     PLANEPTR Planes[8];
  1615.         These eight pointers contain the addresses of the 
  1616.         individual bitplanes for the bitmap. Although now you can
  1617.         only use six of the eight pointers you can see that there
  1618.         are possibilities for future expansions.
  1619.  
  1620.    }
  1621.  
  1622. The BitMap structure contains the addresses for the individual memory areas
  1623. where graphics are stored. In addition, information for the height, width 
  1624. and depth of the bitmap are contained here.
  1625.     
  1626.         --------------------------------------------
  1627.  
  1628.  
  1629. struct Bob
  1630.     {
  1631.     WORD Flags;
  1632.         Through these variables the user can determine how the bob
  1633.         is handled by the system. The SAVEBOB flag tells the system
  1634.         that once the bob is drawn it won't be cleared from the
  1635.         RastPort (brush function). You use BOBISCOMP to make the
  1636.         bob part of an animation component. Make sure that you 
  1637.         also point the pointer BobComp to the corresponding 
  1638.         AnimComp structure.
  1639.  
  1640.         Not only the user can set the bob flags, the system can 
  1641.         also set the so-called status flags. These flags provide
  1642.         information about the status of a bob. For example, the 
  1643.         flag BOBNIX tells us that the bob has disappeared from the
  1644.         RastPort, the background has been restored, and the BOB 
  1645.         was removed from the GEL list.
  1646.  
  1647.     WORD *SaveBuffer;
  1648.         This pointer points to a memory area, reserved by you,
  1649.         where the background will be stored when a bob is drawn.
  1650.         Because bobs are normally written directly into the bitmap,
  1651.         the background where the bob appears is destroyed. When you
  1652.         set the SAVEBACK flag in the vsprite structure the background
  1653.         is saved to the memory area. This area must be at least as 
  1654.         wide an high as the bob being drawn. You must also make sure 
  1655.         that for every bitplane of the RastPort being written to 
  1656.         (see PlanePick and planeOnOff in the VPsrite structure) a 
  1657.         buffer in chip memory is reserved. The background is 
  1658.         saved into these memory buffers.
  1659.     
  1660.                 PAGE 509
  1661.     
  1662. -----------------------------------------------------------------------------
  1663.  
  1664.      WORD *ImageShadow;
  1665.         As you may already know, you define a bob bitplane by 
  1666.         bitplane and use PlanePick and PlaneOnOff to determine in 
  1667.         which plane the bob is drawn. ImageShadow points to a 
  1668.         memory buffer that is large enough to store one bitplane
  1669.         of your bob. All the set pixels in the individual bitplanes
  1670.         for your bob are stored in ImageShadow. In other words, all
  1671.         the Bob-Planes are ORed and stored in ImageShadow  (chip
  1672.         memory).
  1673.  
  1674.     struct Bob *Before;
  1675.     struct Bob *After;
  1676.         These two pointers determine the order the bobs are drawn.
  1677.         They can be used to make the GEL routines use your bobs in a
  1678.         specific order. However, since this function removes 
  1679.         pointers, you must do this after AddBob().
  1680.  
  1681.     struct VSprite *BobVSprite;
  1682.         Each bob requires a vsprite structure because the bob 
  1683.         structure doesn't contain any variables for positioning.
  1684.         In addition, the GEL list is made up of only vsprite     
  1685.         structures and the bob must be in this list somehow. To 
  1686.         make this work, this pointer points to the vsprite structure
  1687.         for the bob (every bob has its own).
  1688.  
  1689.     struct AnimComp *BobComp;
  1690.         This pointer points to the AnimComp structure to which the
  1691.         bob belongs. You set this pointer only after setting the 
  1692.         flag BOBISCOMP.
  1693.  
  1694.     struct DBuffPacket *DBuffer;
  1695.         When you want to use bobs with a double buffered bitmap, 
  1696.         which saves both bitmaps for the background, you must 
  1697.         initialise this pointer to DoubleBufferPacket. This makes
  1698.         it possible for the GEL software to easily display the
  1699.         bobs in both bitmaps, without any extra work (chip mem).
  1700.  
  1701.     BUserStuff BUserExt;
  1702.         Here you, the user, can add your own extensions to the bob
  1703.         structure. Simply used #define BUserStuff to define the 
  1704.         type of extension in your program. This extension can then 
  1705.         be accessed either by the AnimCRoutines, AnimORoutines or 
  1706.         a collision routine. When you don't define BUserStuff, it is
  1707.         automatically defined as a SHORT variable.
  1708.  
  1709. The bob structure defines the bob (blitter object). Bobs can be as large as 
  1710. you want and can contain as many colours as the RastPort in which they are
  1711. used.
  1712.     
  1713.                 PAGE 510
  1714.     
  1715. -----------------------------------------------------------------------------
  1716.  
  1717. struct ColorMap
  1718.  
  1719. You use this structure to set the colours for a ViewPort. To change them
  1720. afterwards use LoadRGB4(), getRGB4() and SetRGB4().
  1721.  
  1722.         --------------------------------------------
  1723.  
  1724. struct Custom
  1725.  
  1726. This structure provides a picture of the hardware registers which helps
  1727. you effictively access them with C. The Appendix for the hardware registers
  1728. describes all the symbol registers for this structure and how to use them
  1729. (chip memory).
  1730.  
  1731.         --------------------------------------------
  1732.  
  1733. struct DBuffPacket
  1734.     
  1735. This structure was designed for using bobs in double buffered bitmaps.
  1736. The backgrounds from both bitmaps, which are selected by you, are saved
  1737. here when the bob is drawn over them. When you set the SAVEBACK flag in
  1738. the vsprite structure the background is saved from only one of four 
  1739. bitmaps. By installing a DBuffPacket(Bob.DBuffer = &DBuffPacket) for every
  1740. bob, you can also save the background of the second bitmap. However, a 
  1741. DBuffPacket cannot be generated for only one bob in a GEL list. Either 
  1742. all or none of the bobs in the GEL list have a DBuffPacket.
  1743.     
  1744. You must also provide the DBuffPacket structure and the address of an 
  1745. additional memory area in chip memory (DBuffPacket.BufBuffer = &Memory).
  1746. This area must be the same size as the Bob.SaveBuffer. The other 
  1747. variables for DBuffPackets are handled by the GEL software.
  1748.     
  1749.         --------------------------------------------
  1750.  
  1751. struct GfxBase
  1752.  
  1753. GfxBase is your pointer to the graphic function library. You initialise
  1754. this library with GfxBase = OpenLibrary("graphics.library",VERSION_NUMBER).
  1755. Now you have access to all the graphic functions that the Amiga has 
  1756. available.
  1757.  
  1758. Also, GfxBase contains a pointer to the currently active View. When you 
  1759. use a program that creates its own View, without intuition, you should
  1760. save the current View. By using OldView = GfxBase->ActiView you can 
  1761. save this pointer, return the intuition View and, thereby, thw workbench 
  1762. screen.
  1763.  
  1764. Another GfxBase structure variable, GfxBase->SpriteReserved provides 
  1765. information on the hardware sprites that are currently available for use.
  1766.     
  1767.                 PAGE 511
  1768.  
  1769. -----------------------------------------------------------------------------
  1770.  
  1771. There are a few more pointer in GfxBase such as the SystemFont list etc..
  1772. that are exclusively for system use. These pointer can also be affected
  1773. by the Graphic functions.
  1774.  
  1775.         --------------------------------------------
  1776.  
  1777. struct GelsInfo
  1778.     {
  1779.     BYTE sprRsrvd;
  1780.         This variable provides information about the sprites 
  1781.         available to the vsprite generator. When your program does
  1782.         not require the hardware sprites simply set all the bits
  1783.         in sprRsrvd. This tells the Amiga to use all the hardware
  1784.         sprites as vsprites. If you want to use both hardware 
  1785.         sprites and vsprites, you must ensure that your hardware 
  1786.         sprites are not used as vsprites. To accomplish this, clear
  1787.         the corresponding bit in SprRsrvd (bit 0 for sprite 0 and 
  1788.         bit 1 for sprite 1 etc..).
  1789.  
  1790.     UBYTE Flags;
  1791.         These variables are used only by the system.
  1792.     
  1793.     struct VSprite *gelHead, *GelTail;
  1794.         The GELs (vsprites and bobs) are organised in a GEL list.
  1795.         These two pointers point to the beginning and end of this 
  1796.         list and are initialised with InitGels().
  1797.  
  1798.     WORD *nextLine;
  1799.         This pointer points to a memory area that is eight words
  1800.         long. It contains information on the highest vertical 
  1801.         positions at which a hardware sprite can be displayed 
  1802.         by using the vsprite software.
  1803.  
  1804.     WORD **lastColor;
  1805.         This eight pointer array helps the copper. It stores the
  1806.         address of the last color definition that was saved for the
  1807.         hardware sprites. This address is compared to the colour 
  1808.         table address for the new sprite that will be displayed.
  1809.         If they are the same, a color change is not performed by the
  1810.         Copper because these colours have already been displayed.
  1811.         When all eight pointers point to the same vsprite color
  1812.         table you can display up to eight vsprites in one raster
  1813.         row instead of only four.
  1814.     
  1815.     struct collTable *collHandler;
  1816.         This is where you store the various addresses for collision
  1817.         routines using SetCollision(). Whether or not these are
  1818.         called depends on which GELs collide with which collision 
  1819.         masks (MeMask and HitMask).
  1820.     
  1821.     short leftmost, rightmost, topmost, bottommost;
  1822.         These four variables are used to set the rectangle 
  1823.         boundaries within which your GELs are confined without 
  1824.         having a Border_Collision. When you GEL exceeds these 
  1825.         boundaries, collision routine zero is called. In order for
  1826.         this to function you must set bit zero in the GELs BitMask.
  1827.  
  1828.                 PAGE 512
  1829.  
  1830. -----------------------------------------------------------------------------
  1831.  
  1832.     APTR firstBlissObj.lastBlissObj;
  1833.         These two pointers are only used by the operating system.
  1834.  
  1835.     }
  1836.  
  1837. The GElsInfo structure contains very important variables and pointers for 
  1838. the GELs (graphic elements). It must be initialised with InitGels() before
  1839. the GEL routines (AddBob(), AddVsprite(), Animate(), AddAnimOb()) can be
  1840. used. This structure must be passed to the initialised RastPort (RastPort.
  1841. GElsInfo = &GelsInfo).
  1842.     
  1843.         --------------------------------------------
  1844.  
  1845. struct IntuiMessage
  1846.  
  1847. This structure allows you to intercept and check messages received by
  1848. Intuition, such as those from a window. With their help you can determine 
  1849. whether or not a menu item has been selected, the mouse has moved or a 
  1850. mouse button has been pressed.
  1851.     
  1852.         --------------------------------------------
  1853.  
  1854. struct IntuitionBase
  1855.  
  1856. Just as any library, the intuition library also has a BasePointer.
  1857. This base pointer is used in the same way as the starting address for 
  1858. accessing the library functions.
  1859.     
  1860.         --------------------------------------------
  1861.  
  1862. struct NewWindow
  1863.     {
  1864.     SHORT LeftEdge, TopEdge;
  1865.     SHORT Width, Height;
  1866.         These four variables determine the position of a window.
  1867.         (LeftEdge (X coordinate), TopEdge (Y coordinate)), width 
  1868.         and height.
  1869.     
  1870.     UBYTE DetailPen, BlockPen;
  1871.         These two variables are used to set the color for your
  1872.         BlockPen and the Title. The values you use here are the 
  1873.         same ones  used for SetAPen() (the number of the colour 
  1874.         register).
  1875.     
  1876.     ULONG IDCMPFlags;
  1877.         The IDCMP flags (Intuition Direct Communication Message
  1878.         Ports) determine the type of communication between the user
  1879.         and Intuition. You can decide what messages are sent, by
  1880.         Intuition to your program. You may also want to receive 
  1881.         messages for a mouseclick (MOUSEBUTTON) or a key press
  1882.         (RAWKEY / VANILLAKEY). Unfortunately, we do not have 
  1883.         enough room here to provide a complete listing of all the
  1884.         IDCMPs.
  1885.     
  1886.                 PAGE 513
  1887.  
  1888. -----------------------------------------------------------------------------
  1889.  
  1890.     ULONG Flags;
  1891.         By using these flags it is possible to describe a window
  1892.         in more detail. For example, you can set BORDERLESS so 
  1893.         the window has no border. With ACTIVATE, a window can be
  1894.         active as soon as you open it and will immediately become
  1895.         the input/output window. Again, a complete list of all the
  1896.         possibilities is not possible here.
  1897.  
  1898.     struct Gadget *FirstGadget;
  1899.         This pointer points to the first gadget you have created.
  1900.         Gadgets are similar to the small boxes seen in the upper 
  1901.         right corner of system windows, which place the window in 
  1902.         the background when they are clicked.
  1903.  
  1904.     struct Image *CheckMark;
  1905.         This pointer points to the Image structure used for the 
  1906.         checkmark, which is used to show static menu items. By 
  1907.         entering a zero here you can use the default checkmark.
  1908.  
  1909.     UBYTE *Title;
  1910.         When you want to use several windows it is easier to give 
  1911.         each one a name or title. This name is displayed in the top
  1912.         row of the window. Title is the pointer to the first 
  1913.         character of your title string (for example, the system 
  1914.         window is named AmigaDOS).
  1915.  
  1916.     struct Screen *Screen;
  1917.         In order for a window to exist, it needs a screen. A window
  1918.         must be displayed at some time. This pointer points to an 
  1919.         opened screen where the window is later displayed.
  1920.  
  1921.     struct BitMap *BitMap;
  1922.         When you have set the SUPER_BITMAP flag in the flags 
  1923.         variables, this pointer must point to the bitmap you have
  1924.         created. It is possible to create a bitmap with 1024*1024
  1925.         pixels and display part of it as large as the window on 
  1926.         your screen.
  1927.  
  1928.     SHORT MinWidth, MinHeight;
  1929.     SHORT MaxWidth, MaxHeight;
  1930.         Once you have set the WINDOWSIZING flag in the flags
  1931.         variables (and also set SIZEBRIGHT (Size Border Right) or
  1932.         SIZEBOTTOM (Size Border Bottom) the window sizing gadget 
  1933.         will appear. This gadget, located in the bottom right 
  1934.         corner of your window, allows you to change the size of 
  1935.         your window. You can set the sizing limits by using the
  1936.         variables MinHeight, MinWidth, MaxHeight and MaxWidth.
  1937.     
  1938.                 PAGE 514
  1939.  
  1940. -----------------------------------------------------------------------------
  1941.  
  1942.     USHORT Type;    
  1943.         This variable lets you determine whether or not this window
  1944.         will appear in the Workbench area (WBENCHSCREEN). Here you
  1945.         must set the screen structure pointer to zero otherwise the
  1946.         window will appear in its own screen (CUSTOMSCREEN). You 
  1947.         must also provide the NewWindow structure with an address
  1948.         for the screen where the window should appear.
  1949.  
  1950.     }
  1951.  
  1952. These structures let you describe a window. After setting all the pointers
  1953. and variables, call Window = OpenWindow (&NewWindow). As an example, you 
  1954. can now use your window for graphic output.
  1955.  
  1956.         --------------------------------------------
  1957.  
  1958. struct NewScreen
  1959.     {
  1960.     SHORT LeftEdge, TopEdge, Width, Height, Depth;
  1961.         These variables allow you to set the position, size and
  1962.         depth (number of bitplanes) for your screen. While doing
  1963.         this, you must also ensure that your window cannot be 
  1964.         moved horizontally (in the X direction). Otherwise, values
  1965.         for LeftEdge that are not equal to zero will have the same
  1966.         effect as if they were equal to zero.
  1967.     
  1968.     UBYTE DetailPen, BlockPen;
  1969.         The colour for text (DetailPen) and title (BlockPen) for
  1970.         the top screen row are also set here in the same way as 
  1971.         windows.
  1972.  
  1973.     USHORT ViewModes;
  1974.         In this variable you can set the display resolution mode
  1975.         for your screen.
  1976.  
  1977.     USHORT Type;
  1978.         This variable sets the type of screen and must always be
  1979.         specified as CUSTOMSCREEN. When you initialise your own 
  1980.         bitmap you also have to set the CUSTOMBITMAP flag.
  1981.  
  1982.     struct TextAttr *Font;
  1983.         If you want to use a different font with your screen you 
  1984.         can select it here. Simply define a TextAttr structure
  1985.         describing the new font and provide the address. This
  1986.         screen and any windows within it will use the selected 
  1987.         font. To use the default font (Topaz) set this variable
  1988.         to zero.
  1989.  
  1990.     UBYTE *DefaultTitle;
  1991.         As with windows, this pointer points to a title text 
  1992.         string for the top screen row of your screen. (The 
  1993.         Workbench screen has the title "Workbench screen"). If you
  1994.         do not want a title set this pointer to zero.
  1995.     
  1996.                 PAGE 515
  1997.  
  1998. -----------------------------------------------------------------------------
  1999.  
  2000.     struct Gadget *Gadgets;
  2001.         Currently this pointer is not used and should be set to 
  2002.         zero for guaranteed upward compatibility.
  2003.  
  2004.     struct BitMap *CustomeBitMap;
  2005.         This pointer points to your bit-map when Type is set to 
  2006.         CUSTOMBITMAP.
  2007.  
  2008.     }
  2009.  
  2010. The NEWSCREEN structure is used to describe a screen. It is opened with 
  2011. Screen = OpenScreen (&NewScreen).
  2012.     
  2013.         --------------------------------------------
  2014.  
  2015. struct RastPort
  2016.     {
  2017.     struct Layer *Layer;
  2018.         This pointer points to the Layer structure of the 
  2019.         RastPort. Layers are data structures that help manage
  2020.         windows. They prevent a window from overwriting another
  2021.         by mistake.
  2022.  
  2023.     struct BitMap *BitMap;
  2024.         This is the pointer to the BitMap used by the RastPort. For
  2025.         screens other than Intuiton this must be initialised later.
  2026.  
  2027.     USHORT *AreaPtrn;
  2028.         This pointer points to the fill pattern of the RastPort.
  2029.         Normally an area is filled without any special pattern, but
  2030.         by using the macro SetAfPt() you can change the fill pattern.
  2031.  
  2032.     struct TmpRas *TmpRas;
  2033.         This pointer points to an additional memory area that is
  2034.         used for the fill functions Area...() and Flood. This area 
  2035.         must be large enough to store the entire area that is being 
  2036.         filled.
  2037.  
  2038.     struct AreaInfo *AreaInfo;
  2039.         This pointer is only used by the Area().. commands. The
  2040.         points for a polygon set by AreaDraw() and AreaMove() 
  2041.         must be stored in some location. Use InitArea() to 
  2042.         initialise an AreaInfo structure that contains sufficient
  2043.         memory (five bytes per coordinate). Then link this structure
  2044.         to the RastPort for get AREA(RastPort.AreaInfo = 
  2045.         &AreaInfo).
  2046.  
  2047.     struct GelsInfo *GelsInfo;
  2048.         This structure is used to display vsprites and bobs in a 
  2049.         RastPort. It contains a linked list of all the graphic
  2050.         elements for Vsprites. You can sort and display this list
  2051.         by using SortGList() and DrawGList().
  2052.     
  2053.                 PAGE 516
  2054.     
  2055. -----------------------------------------------------------------------------
  2056.  
  2057.     UBYTE Mask;
  2058.         This variable contains information about which bitplanes
  2059.         of a RastPort are affected by a graphic operation. The 
  2060.         normal value is 0xff which means all bitplanes are affected
  2061.         (each set bit represents an on bitplane). You can change 
  2062.         this variable as required with SetWrMsk(&RastPort, Mask)
  2063.  
  2064.     BYTE FgPen;        
  2065.         This variable contains the number of the color register
  2066.         that is responsible for setting the APen colour. FGPen ==
  2067.         APen, the APen was previously named ForegroundPen.
  2068.  
  2069.     BYTE BgPen;
  2070.         BgPen == BPen. (Bpen was the BackgroundPen).
  2071.  
  2072.     BYTE AOIPen;
  2073.         AOIPen (Area Outline Pen) == Open
  2074.     
  2075.     BYTE DrawMode;
  2076.         This variable contains the actual drawing mode set by the
  2077.         macro SetDrMd().
  2078.  
  2079.     BYTE AreaPtSz;
  2080.         This variable contains the number of rows that are in the 
  2081.         fill pattern. This can always be changed by using SetAfPt(),
  2082.         but remember that the height must be set in powers of two.
  2083.  
  2084.     BYTE linpatent;
  2085.         This help variable is used for drawing lines.
  2086.  
  2087.     BYTE dummy;    
  2088.     USHORT Flags;
  2089.         These variables contain various flags. For example, they 
  2090.         can determine whether the first pixel of a line is drawn 
  2091.         (FLAGS \= FRST_DOT) or if only one pixel per raster row 
  2092.         is drawn (ONE_DOT). Another example is whether Area..()
  2093.         frames an area with the color of the OPen (Flags \= 
  2094.         AREAOUTLINE).
  2095.  
  2096.     USHORT LinePtrn;
  2097.         This variable contains the 16 bit line pattern that can be 
  2098.         set with the macro SetDrPt().
  2099.  
  2100.     SHORT cp_x, cp_y;
  2101.         These two variables contain the X and Y position of the
  2102.         graphic cursor, which you can position within the bitmap
  2103.         with the Move() Command.
  2104.  
  2105.     UBYTE minterms[8];
  2106.         We do not have much information for this and the following 
  2107.         two variables. The reason for this is that these parameters
  2108.         dont provide any visible results when they are changed.
  2109.     
  2110.                 PAGE 517
  2111.  
  2112. -----------------------------------------------------------------------------
  2113.  
  2114. SHORT PenWidth, /* See minterms */
  2115. SHORT PenHeight, /* See minterms */
  2116.  
  2117.     struct TextFont *Font;
  2118.         This pointer points to the TextFont structure for the font 
  2119.         currently in use. When the normal font "topaz.font" 
  2120.         becomes tiresome you can change fonts by using OpenFont()
  2121.         and SetFont().
  2122.  
  2123.     UBYTE AlgoStyle;
  2124.         This text contains the text style that you set with 
  2125.         SetSoftStyle().
  2126.  
  2127.     UBYTE TxFlags;
  2128.         This variable contains the flags that define your font in 
  2129.         detail for the RastPorts. Here you can determine whether 
  2130.         a font supports proportional characters (TxFlags ==
  2131.         FPF_PROPORTIONAL), is loaded from RAM (FPF_ROMFONT) or 
  2132.         from disk (FPF_DISKFONT).
  2133.  
  2134.     UWORD TxHeight;
  2135.         This variable provides the character height of the current
  2136.         RastPort font.
  2137.  
  2138.     UWORD TxWidth;
  2139.         This is the average width of the individual characters.
  2140.  
  2141.     UWORD TxBaseline;
  2142.         This variable contains the position of the baseline for the
  2143.         font. With the style FPF_UNDERLINED the baseline is drawn
  2144.         in with each character for underlining. The most important
  2145.         aspect of the baseline is text positioning with Text().
  2146.         Strings are not positioned by using a Y position for the
  2147.         top line of the text. The string is positioned by a Y 
  2148.         position of the graphic cursor and the baseline.
  2149.     
  2150.     WORD TxSpacing;
  2151.         This variable sets the pixel width for each character (the
  2152.         width of a character). This apllies to the display of single
  2153.         characters but not strings.
  2154.  
  2155.     APTR *RP_User;
  2156.         This variable is reserved for the user. You can use this 
  2157.         variable, for example, to link your own data structures with
  2158.         the RastPort for special purposes.
  2159.  
  2160.                 PAGE 518
  2161.     
  2162. -----------------------------------------------------------------------------
  2163.     
  2164.     UWORD wordreserved[7];  /* reserved */
  2165.     ULONG longreserved[2];  /* reserved */
  2166.     UBYTE reserved[8]; /* reserved */
  2167.     }
  2168.  
  2169. When changing a bitmap, The RastPort structure is the most important 
  2170. structure. Most graphic commands require a RastPort structure because
  2171. the actual values of the foreground pen and many other variables are
  2172. available
  2173.  
  2174. After initialising the RastPort with InitRastPort (&RastPort), simply 
  2175. initialise the bitmap pointer with RastPort.BitMap = &BitMap.
  2176.  
  2177.         --------------------------------------------
  2178.  
  2179. struct Rasinfo
  2180.     {
  2181.     struct RasInfo *Next;
  2182.         When you have set your ViewPort for DUALPF display mode
  2183.         (Dual Playfields) you also have to specify two bitmaps that
  2184.         overlap in the ViewPort. Here you link two RasInfo 
  2185.         structures that point to one of the two BitMaps by using
  2186.         RasInfo1.Next = &RasInfo2. Then the first of the two 
  2187.         RasInfo structures is made available to the ViewPort with
  2188.         ViewPort.RasInfo = &RasInfo1;. The rest happens as usual
  2189.         when opening the View and ViewPorts.
  2190.  
  2191.     struct BitMap *BitMap;
  2192.         This is the pointer to the bitmap of the RasInfo structure
  2193.         that will be displayed in the ViewPort.
  2194.  
  2195.     SHORT RxOffset, RyOffset;
  2196.         These two variables determine which pixel of the BitMap
  2197.         lines up with the upper left corner of the ViewPort. They
  2198.         are normally set to zero which means that the upper left
  2199.         corner of the BitMap and the ViewPort line up exactly. By
  2200.         changing these values and then calculating a new Copper 
  2201.         list you can achieve a scrolling bitmap.
  2202.                
  2203.     }
  2204.  
  2205. The RasInfo structure is the referee between ViewPort and BitMap.
  2206.  
  2207.         --------------------------------------------
  2208.  
  2209. struct Screen
  2210.  
  2211. This structure which is similar to the window structure, provides access to 
  2212. an already opened screen (Screen = OpenScreen(&NewScreen). All system 
  2213. structures, such as those used for graphic output (Screen->RastPort.xxx,
  2214. Screen.ViewPort.xxx etc...), are available to you through this structure.
  2215.  
  2216.                 PAGE 519
  2217.  
  2218. -----------------------------------------------------------------------------
  2219.  
  2220. struct SimpleSprite
  2221.     {
  2222.     UWORD *posctldata;
  2223.         This pointer points to a memory area in this form;
  2224.  
  2225.     struct SpriteData
  2226.         {    
  2227.         UWORD posctl[2];
  2228.            /* represents the hardware register 
  2229.               'spr[x].pos' and 'spr[x].ctl' )
  2230.  
  2231.         UWORD Appearance[Height*2];
  2232.             /* This array contains the appearance of */
  2233.             /* the sprites row for row defined in     */
  2234.             /* Two UWORDs                  */
  2235.     
  2236.         UWORD reserved[2] = {0,0};
  2237.         }
  2238.     You must create the spritedata structure yourself because it does 
  2239.     not exist in an include file.
  2240.     
  2241.     UWORD Height;
  2242.         This variable contains the height of the sprites. Sprites
  2243.         are always 16 pixels (1 word) high.
  2244.  
  2245.     UWORD x,y;
  2246.         These two variables contain the current position of the
  2247.         sprites.
  2248.  
  2249.     UWORD num;
  2250.         This variable contains the number of the hardware sprites
  2251.         (0-7) that are described and changed by the SimpleSprite 
  2252.         structure.
  2253.     
  2254.     }
  2255.  
  2256. The SimpleSprite structure permits the use if a hardware sprite. Sprites are
  2257. always 15 pixels wide and can be any desired height.
  2258.  
  2259. You, as the programmer, must provide the strutures that determine the
  2260. appearance of the sprites (SpriteData). Then use SimpleSprite.posctldata = 
  2261. (UWORD *) &SpriteData to pass this data to the SimpleSprite structure.
  2262.  
  2263.         --------------------------------------------
  2264.  
  2265. struct TextAttr;
  2266.     {
  2267.     STRPTR ta_Name;
  2268.         This pointer points to the name of the font ("name.font")
  2269.         that you want to open with OpenFont() or OpenDiskFont().
  2270.  
  2271.                 PAGE 520
  2272.  
  2273. -----------------------------------------------------------------------------
  2274.  
  2275.     UWORD ta_YSize;
  2276.         This is where the height in rows is stored for your font.
  2277.  
  2278.     UBYTE ta_Style;
  2279.         You use this variable to set a beginning style for the
  2280.         font you opened above.
  2281.  
  2282.     UBYTE ta_Flags;
  2283.         This variables tells you whether or not your font can use
  2284.         proportional characters.
  2285.  
  2286. This structure is used by the command OpenFont() and OpenDiskFont(). The 
  2287. variables ta_Name and ta_YSize are used to try to load a specific font and
  2288. also find a font that best fits your selected parameters.
  2289.  
  2290.         --------------------------------------------
  2291.  
  2292. struct TextFont
  2293.  
  2294. This structure is used to access a font opened with OpenFont() or 
  2295. OpenDiskFont(). It can be linked to a RastPort with SetFont() or added 
  2296. to the system font list with AddFont() amd removed with RemFont().
  2297.  
  2298.         --------------------------------------------
  2299.  
  2300. struct TmpRas;
  2301.  
  2302. The TmpRas structure is used by the fill commands Flood and Area.. It 
  2303. must be initialised with InitTmpRas and linked to a RastPort. Now you can
  2304. use the Area... and Flood commands with this RastPort.
  2305.  
  2306. The TmpRas structure is used to make an area of memory available for use.
  2307. It must be large enough to store a bitplane of the largest element you
  2308. want filled. This is a requirement of the recursive fill algorithm.
  2309.  
  2310.         --------------------------------------------
  2311.  
  2312. struct View 
  2313.     {
  2314.     struct ViewPort *ViewPort;            
  2315.         This is the pointer for the first ViewPort of the View.
  2316.  
  2317.     struct cprlist *LOFCprList;
  2318.         This is the pointer to the Copper list created with 
  2319.         MrgCop().
  2320.  
  2321.     struct cprlist *SHFCprList;
  2322.         This is also a pointer to a copper list, but this list is
  2323.         only used with interlace mode and is required because 
  2324.         LOFCprList is always used.
  2325.     
  2326.                 PAGE 521
  2327.  
  2328. -----------------------------------------------------------------------------
  2329.  
  2330.     short DyOffset, DxOffset;
  2331.         These two variables determine the position of your View on 
  2332.         the monitor. They are automatically set by InitView() so 
  2333.         you dont have to worry about the View programming.
  2334.  
  2335.     UWORD Modes;
  2336.         This variable contains the resolution mode of the View. In
  2337.         order to use the interlace mode in any particular View, you
  2338.         must set it here.
  2339.  
  2340.     }
  2341.  
  2342. The View structure is the manager of graphic displays and provides the most
  2343. important link between you and the system.
  2344.     
  2345.     
  2346.         --------------------------------------------
  2347.  
  2348. struct ViewPort
  2349.     {
  2350.     struct ViewPort *Next;
  2351.         Since it is possible to display more than one ViewPort in 
  2352.         a View, this is the pointer to the next ViewPort. The
  2353.         ViewPorts must also be linked together. After using 
  2354.         InitVPort() this pointer equals zero which means that 
  2355.         there are no other ViewPorts.
  2356.  
  2357.     struct ColorMap *ColorMap;
  2358.         This pointer determines the ColorMap of the ViewPort.
  2359.         Because every ViewPort has its own colormap it is possible to
  2360.         set different colours for each ViewPort within a View.
  2361.  
  2362.     struct CopList *DspIns;        /* Display instructions */
  2363.     struct CopList *SprIns;        /* Sprite Instructions   */
  2364.     struct CopList *ClrIns;        /* Sprite Instructions   */
  2365.     struct CopList *UCopList *UCopIns;
  2366.         These are the pointers to the intermediate or ViewPort 
  2367.         Copper list created with MakeVPort().
  2368.  
  2369.     SHORT DWidth, DHeight;
  2370.         These two variables determine the height and width of the 
  2371.         ViewPort in pixels. For example, the number of lines used 
  2372.         for this ViewPorts resolution (hi-res or lace).
  2373.  
  2374.     SHORT DxOffset, DyOffset;
  2375.         These two variables determine the position of the ViewPort
  2376.         within the View. InitVPort() sets these equal to zero, so 
  2377.         you will have to change them.
  2378.  
  2379.     UWORD Modes;
  2380.         This is where you set the resolution mode of the ViewPort.
  2381.         You are not limited in choice since HAM, Extra Halfbrite,
  2382.         sprites and all the modes are available. Remember to always
  2383.         use the highest resolution mode that you will be using in 
  2384.         your View.
  2385.  
  2386.     UWORD reserved;
  2387.     struct RasInfo *RasInfo;
  2388.         This pointer makes the link between ViewPort and bitmap
  2389.         through the RasInfo structure.
  2390.     }
  2391.  
  2392. The ViewPort that is described by the ViewPort structure is the window 
  2393. through which you can see your bitmap on the monitor.
  2394.  
  2395.                 PAGE 522
  2396.  
  2397. -----------------------------------------------------------------------------
  2398.  
  2399. struct VSprite
  2400.     {
  2401.     struct VSprite *NextVSprite;
  2402.     struct VSPrite *PrevVSprite;
  2403.         These two pointers are used to create the GEL list which is
  2404.         sorted using SortGList() by X and Y values (See below for
  2405.         display).
  2406.  
  2407.     struct VSprite *DrawPath;
  2408.     struct VSprite *ClearPath;
  2409.         These pointers are used to display the bobs in an organised
  2410.         manner. DrawPath writes the bobs into the RastPort. 
  2411.         ClearPath is calculated from DrawPath and, as desired, 
  2412.         removes the bobs from the RastPort and restores the 
  2413.         background.
  2414.  
  2415.     WORD OldY, OldX;
  2416.         These two pointers are used to restore the background 
  2417.         covered by a bob when a bob moves. By setting the SAVEBACK
  2418.         flag in the the VSprite structure for a bob and defining a
  2419.         memory buffer area, you can save the background that is 
  2420.         hidden when a bob is displayed. When you move the bob and 
  2421.         call DrawGList(), the old background is displayed again. The
  2422.         old bob position is stored in OldX and OldY so the computer
  2423.         knows where to restore the background.
  2424.  
  2425.     WORD Flags;
  2426.         This variable determines how the system handles the Vsprite.
  2427.         When the VSprite structure is being used to display 
  2428.         vsprites then Flags = VSPRITE. However, bobs also use this 
  2429.         structure.
  2430.  
  2431.     WORD Y,X;
  2432.         These two variables determine the position of the VSPRITE 
  2433.         or bob on the screen.
  2434.     
  2435.                 PAGE 523
  2436.  
  2437. -----------------------------------------------------------------------------
  2438.  
  2439.     WORD Height;
  2440.         This variable sets the number of vertical rows for a 
  2441.         vsprite or Bob.
  2442.  
  2443.     WORD Width;
  2444.         This variable determines how many words are used to display
  2445.         one row of a bob. A value of one is used for width when 
  2446.         using vsprites because they cannot be wider than 16 pixels
  2447.         ( = 16 bits = 1 word).
  2448.  
  2449.     WORD Depth;
  2450.         This is where you set the bitplanes for the bob. This is
  2451.         actually how many bitplanes you have defined for the bob.
  2452.         Please note that your bob cannot have a depth greater than 
  2453.         the RastPort in which it is used. However, a bob can have 
  2454.         less bitplanes than the RastPort.
  2455.     
  2456.     WORD MeMask;
  2457.     WORD HitMask;
  2458.         You use these two variables to determine which collision
  2459.         routine (if any) is executed upon a collision with another
  2460.         GEL. The MeMask of one and the hitmask of the other GEL 
  2461.         are ANDed and the result bit determines which collision 
  2462.         routine is used. (bit 1=> routine 1, bit2 => routine2, ...
  2463.         bit 15 => routine 15).
  2464.  
  2465.         When you set bit zero in HitMask , a GEL border collision
  2466.         calls  routine zero.
  2467.  
  2468.     WORD *ImageData;
  2469.         This pointer points to the bob/vsprite data that determine
  2470.         their appearance. This data must be stored in chip memory.
  2471.  
  2472.     WORD *BorderLine;
  2473.     WORD *CollMask;
  2474.         These two pointers point to memory buffer areas, defined by
  2475.         you, for the BorderLine and CollisionMask. They are also 
  2476.         used to detect collisions.
  2477.     
  2478.         The Borderline contains as many words as the width of a 
  2479.         bob or vsprite (vsprites are always one word wide). 
  2480.         Borderline os a logical OR of all the GEL rows. The ColMask
  2481.         is exactly the same size as your GEL, but is only one 
  2482.         bitplane deep. ColMask contains a logical OR of all plane
  2483.         data. (Both of these buffers must be created by you and are
  2484.         initialised with InitMasks(). They must also be located in 
  2485.         chip memory.
  2486.  
  2487.     WORD *SprColors;
  2488.         This pointer points to a three UWORD memory area that 
  2489.         contains the VSprite colors.
  2490.  
  2491.                 PAGE 524
  2492.     
  2493. -----------------------------------------------------------------------------
  2494.  
  2495.     struct Bob *VSBob;
  2496.         If you dont set the VSprite.Flag in the VSprite.Flags 
  2497.         variables, the system assumes that your vsprite structure
  2498.         is being used to describe a bob. This pointer points to the
  2499.         bob structure of the vsprite.
  2500.  
  2501.     BYTE PlanePick;
  2502.     BYTE PlaneOnOff;
  2503.         These two variables determine which bit-planes are on 
  2504.         (PlanePick) for displaying your bobs and which are passive
  2505.         and written with the Bobs ImageShadow.
  2506.  
  2507.     VUserStuff VUserExt;
  2508.         With the help of this "extension", the user can combine
  2509.         his own data into the vsprite. The VUserStuff function 
  2510.         can be defined at any point before the #include statements
  2511.         are executed (e.g. #define VUserStuff struct Speed (vx,vy);
  2512.  
  2513.     }
  2514.  
  2515. The vsprite structure is needed for both types of GELs. Both the vsprite
  2516. itself and the bob are applications of this structure.
  2517.  
  2518.  
  2519.         --------------------------------------------
  2520.  
  2521. struct Window
  2522.  
  2523. When you open a new window using WINDOW = OpenWindow(NewWindow), you can
  2524. write in the window, bypassing the window structure. This is because you
  2525. have a RastPort available (Window->RastPort).
  2526.  
  2527. In addition, you can get the window information from Intuition. However,
  2528. a detailed description of this will go far beyond the scope of this 
  2529. Appendix.        
  2530.         
  2531.                 PAGE 525
  2532.  
  2533. -----------------------------------------------------------------------------
  2534.  
  2535.               APPENDIX B - THE LIBRARY FUNCTIONS
  2536.  
  2537. This appendix provides the C programmer with information about the 
  2538. library routines used in this book.
  2539.  
  2540. First you must open the required libaries (with Openibrary()) before you
  2541. can use the library routines.
  2542.  
  2543. We have organised the following routine listing by library and in 
  2544. alphabetical order.
  2545.  
  2546. GFXBASE: First the GfxBase routines :
  2547.  
  2548.     ------------------------------------------------------------------
  2549.  
  2550. AddAnimOb(&AnimOb, &AnimKey, &RastPort)
  2551.  
  2552.     These routines are used to organise, in the GEL list of a specific
  2553.     RastPort, all the bobs for the animation object. This makes it
  2554.     possible for DrawGList() to draw the bobs in an orderly manner.
  2555.     The AnimKey points to the last added AnimOb. AnimKey must be equal
  2556.     to zero for the first AddAnimOb() call (struct AnimOb*AnimKey = 0).
  2557.  
  2558.     ------------------------------------------------------------------
  2559.  
  2560. AddBob(&Bob,&RastPort)
  2561.  
  2562.     This routine adds the specified bob structure for the defined bob
  2563.     (Blitter object) to the GEL list for the selected RastPort. You 
  2564.     must do this so the bob can later be drawn with DrawGList().
  2565.  
  2566.     See: AddVSprite(), DrawGList(), SortGList(), InitGList()
  2567.  
  2568.     ------------------------------------------------------------------
  2569.  
  2570. AddFont(&TextFont)
  2571.  
  2572.     This function links the specified TextFont structurem which defines
  2573.     your font, with the SystemFontList.
  2574.  
  2575.     Once this is done, your font is available to any program you are
  2576.     using.
  2577.     
  2578.                 PAGE 527
  2579.     
  2580. -----------------------------------------------------------------------------
  2581.  
  2582. AddVSprite(&VSprite,&RastPort)
  2583.  
  2584.     This routine adds the specified vsprite structure, which defines 
  2585.     your vsprite (virtual sprite), to the GEL list of the selected 
  2586.     RastPort. This is needed so that DrawGList() can later display 
  2587.     your Vsprite.
  2588.  
  2589.     See: AddBob(), DrawGList(), SortGList(), InitGList()
  2590.  
  2591.     ------------------------------------------------------------------
  2592.  
  2593. Pointer = AllocRaster(Width, Height)
  2594.  
  2595.     This function enables you to allocate a memory area for a bitplane
  2596.     in a size specified by the width and height. After calling this
  2597.     routine, the first word of the memory address is returned in
  2598.     pointer.
  2599.  
  2600.     See: FreeRaster()
  2601.  
  2602.     ------------------------------------------------------------------
  2603.  
  2604. Animate(&AnimOb,&RastPort)
  2605.  
  2606.     This routine applies to all animation objects that are linked to 
  2607.     an AnimOb. Animate calculates the new object positions and resets 
  2608.     Timer for the animation components. In a ring animation 
  2609.     (AnimComp.Flags = RINGTRIGGER), when Timer for a component is equal
  2610.     to zero the next sequence is activated.
  2611.  
  2612.     See: AddAnimOb()
  2613.  
  2614.     ------------------------------------------------------------------
  2615.  
  2616. AreaDraw(&RastPort,x,y)
  2617.     
  2618.     This function adds a polygon to the AreaInfo structure for the 
  2619.     specified RastPort. X and Y determine the coordinates of this 
  2620.     point in the BitMap.
  2621.  
  2622.     See: AreaMove(), AreaEnd(), InitArea()
  2623.     
  2624.                 PAGE 528
  2625.  
  2626. -----------------------------------------------------------------------------
  2627.  
  2628. AreaEnd (&RastPort)
  2629.  
  2630.     This function executes the drawing of a polygon, which is defined
  2631.     with AreaMove() and AreaDraw(). It also fills the polygons with the
  2632.     current fill pattern controlled by the current APens, BPens, OPens
  2633.     and Draw modes.
  2634.  
  2635.     The APen and BPen determine the color of the fill pattern. The 
  2636.     OPen sets the framing colour for the polygon.
  2637.  
  2638.     Remember that you must first initialise an Area and TmpRas structure
  2639.     in the RastPort where the polygon will be drawn. Unless you do 
  2640.     this first, filling an area using the Area... function will not 
  2641.     function.
  2642.     
  2643.     See: AreaDraw(), AreaMove(), InitArea(), InitTmpRas.
  2644.  
  2645.     ------------------------------------------------------------------
  2646.  
  2647. error = AreaEllipse(&RastPort, XMiddle, YMiddle, XRadius, YRadius)
  2648.  
  2649.     This function allows you to draw an ellipse in the selected RastPort.
  2650.     The centre is at XMiddle,YMiddle. XRaduis and YRadius set the
  2651.     radius for the ellipse. (When XRadius = YRadius a filled circle 
  2652.     is drawn. Remember that XRadius and YRadius must be greater than 
  2653.     zero).
  2654.  
  2655.     AreaEllipse is an expansion of the Area.. function. This means that
  2656.     a filled ellipse is drawn using the current fill pattern.. It also
  2657.     means that an AreaInfo amd TmpRas structure must exist in the 
  2658.     selected RastPort.
  2659.  
  2660.     The variable ERROR provides information about the vector table,
  2661.     which contains the coordinates for the polygon plot points in
  2662.     AreaInfo. It tells you whether or not there is enough room 
  2663.     (minimal (2+1)*5 bytes) for the data required for an ellipse
  2664.     (error = 0). If ERROR returns a -1 there isnt enough room.
  2665.  
  2666.     You must call AreaEnd() to execute the drawing of the ellipse.
  2667.  
  2668.     See: AreaDraw(), AreaEnd(), AreaMove(), InitArea(), InitTmpRas.
  2669.  
  2670.                 PAGE 529
  2671.  
  2672. ----------------------------------------------------------------------------
  2673.  
  2674. AreaMove(&RastPort,x,y)
  2675.  
  2676. AFter building your polygon with AreaDraw(), close it with this routine.
  2677. Any additional AreaDraw() functions will start a new polygon with the 
  2678. above coordinates.
  2679.  
  2680. See: AreaDRaw(), AreaEnd(), InitArea()
  2681.  
  2682.     ------------------------------------------------------------------
  2683.  
  2684. AskFont(&RastPort, &TextAttr)
  2685.  
  2686.     This function initialises, in the selected RastPort, the specified
  2687.     TextAttr structure with the values of the current font. You can
  2688.     use this function to check the RastPort for the currently active
  2689.     font.
  2690.  
  2691.     See: SetFont()
  2692.     
  2693.     ------------------------------------------------------------------
  2694.  
  2695. Style = AskSoftStyle(&RastPort)
  2696.  
  2697.     This function moves, into the selected RastPort, all the possible
  2698.     font styles that can be set with AskSoftStyle. Each set bit in 
  2699.     style represents a font style:
  2700.  
  2701.         FSF_UNDERLINED  = Bit 0    = 1 (Underlined)
  2702.         FSF_BOLD        = Bit 1    = 2 (Bold)
  2703.         FSF_ITALIC      = Bit 2    = 4 (Italic)
  2704.         FSF_NORMAL      = No set bit = 0
  2705.  
  2706.     See: SetSoftStyle()
  2707.  
  2708.     ------------------------------------------------------------------
  2709.  
  2710. BitPlanes = BltBitMap(&SourceBitMap,X1,Y1,&TargetBitMap,X2,Y2,Width,
  2711.                Height,Minterm,Mask,Buffer).
  2712.  
  2713.     This function blitters a rectangle from one bitmap into another 
  2714.     bitmap. You must specify the source rectangle coordinates from the 
  2715.     SourceBitMap(X1,Y1) and the position for the rectangle in the 
  2716.     TargetBitMap(X2,Y2). Since the width and the height are the same for
  2717.     both rectangles, they are set only once. You must reference both the
  2718.     source and target bitmaps. Remember that these can also be references
  2719.     within the same bitmap.
  2720.  
  2721.                 PAGE 530
  2722.  
  2723. -----------------------------------------------------------------------------
  2724.  
  2725.     You also specify the minterm which determines how the source and 
  2726.     target rectangles are logically mixed. What the minterms do and 
  2727.     which ones exist is discussed in Chapter 16.
  2728.  
  2729.     The Mask parameter determines which bitplanes are blittered. The
  2730.     default value is $ff which means that all bitplanes are referenced.
  2731.     You can also filter out specific bitplanes by clearing the 
  2732.     corresponding bit (bit zero for bitplane zero etc.).
  2733.  
  2734.     Buffer points to a memory area that is used when a target and source
  2735.     rectangle overlap in the same bitmap. This buffer must have enough
  2736.     memory to store one row of the rectangle. When you are sure that the
  2737.     two rectangles do not overlap, you can set the pointer to zero.
  2738.  
  2739.     The result returned by this function is from the "Blit" affected
  2740.     bitplanes (see Mask).
  2741.  
  2742.     Remember that this routine doesnt test whether the target 
  2743.     rectangle fits completely within the target bitmap. It is possible 
  2744.     to blitter over the edge of a bitmap. This can cause errors which
  2745.     results in less bitplanes  being affected than expected. With 
  2746.     extreme error conditions you will encounter the familiar Guru
  2747.     Meditation.
  2748.  
  2749.     See: ClipBlit()
  2750.  
  2751.     ------------------------------------------------------------------
  2752.  
  2753. BltBitMapRastPort(&SourceBitMap,X1,Y1,&TargetRastPort,X2,Y2,Width,
  2754.            Height,Minterm)
  2755.  
  2756.     This function performs exactly the same operation as BltBitMap().
  2757.     This time you are moving a rectangle from a bitmap into a
  2758.     RastPort.
  2759.     
  2760.     The Mask and Buffer parameters are not required here.
  2761.  
  2762.     THe result returned by this function is TRUE = successful,
  2763.     FALSE = error.
  2764.  
  2765.     See: BltBitMap()
  2766.     
  2767.     ------------------------------------------------------------------
  2768.  
  2769. BltClear(&Memory, NumBytes, Flags)
  2770.  
  2771.     As the name indicates, this function erases a selected memory area.
  2772.     You simply specify the starting address.
  2773.     
  2774.     The flag parameter determines how the NumBytes value is interpreted:
  2775.  
  2776.                 PAGE 531
  2777.     
  2778. -----------------------------------------------------------------------------
  2779.  
  2780.     With bit one of the flag parameter set to 1:
  2781.     
  2782.     The upper 16 bits of NumBytes is the number of lines to erase.
  2783.     
  2784.     The lower 16 bits of NumBytes is the number of bytes per line 
  2785.     to erase.
  2786.  
  2787.  
  2788.     Width bit one set to zero NumBytes represents the actual number of 
  2789.     bytes to erase.
  2790.  
  2791.     Bit zero of the flags parameter determines whether the function is 
  2792.     immediately return to the program or wait until the blitter has 
  2793.     erased everything.
  2794.     
  2795.     ------------------------------------------------------------------
  2796.  
  2797. BltTemplate(&Source, BitPosition, Modulo, &RastPort, X, Y, Width,
  2798.          Height)
  2799.     
  2800.     This function uses the blitter to transfer data from a packed
  2801.     array into a RastPort. You provide the address of the packed 
  2802.     array and the bit position within this array, where the data 
  2803.     read should start.
  2804.     
  2805.     Modulo specifies the number of bytes for one row in the data array.
  2806.     X,Y, width  and height set where and how much data from the array is
  2807.     moved to the RastPort.
  2808.     
  2809.     ------------------------------------------------------------------
  2810.  
  2811. ChangeSprite(&ViewPort,&Sprite,&SpriteData)
  2812.     
  2813.     This function changes the appearance of the specified hardware 
  2814.     sprites. Remember that the hardware sprite must be initialised 
  2815.     already. This ensures that the height and screen position are already
  2816.     set and that the correct hardware sprite (SimpleSprite.num) is 
  2817.     affected.
  2818.     
  2819.     The data used by this function have the following format:
  2820.     
  2821.         struct SpriteData
  2822.         {
  2823.             UWORD posctl[2];
  2824.             UWORD Data[Height][2];
  2825.             UWORD Reserved[2]; /* = 0,0 */
  2826.         }
  2827.     
  2828.     posctl represents the sprite hardware register spr[x].pos and 
  2829.     spr[x].ctl. This allows the user to use GetSprite() to reserve both
  2830.     the even and odd numbered sprites and set the SPRITE_ATTACHED bit in
  2831.     posctl[l] for attached sprites. When the bit pattern of both sprites
  2832.     overlap, they are merged. This permits the use of 15 colors instead
  2833.     of only three (plus transparent).
  2834.  
  2835.     See: GetSprite(), FreeSprite(), MoveSprite()
  2836.  
  2837.                 PAGE 532
  2838.     
  2839. -----------------------------------------------------------------------------
  2840.  
  2841. ClearEOL(&RastPort)
  2842.  
  2843.     This function deletes one row, in the selected RastPort, that has 
  2844.     the height of the character in the current font. This deletion 
  2845.     starts at the current graphic cursor position (RastPort.cp_x,
  2846.     RastPort.cp_y).
  2847.  
  2848.     See: ClearScreen(), Move()
  2849.     
  2850.     ------------------------------------------------------------------
  2851.  
  2852. ClearScreen(&RastPort)
  2853.  
  2854.     In contrast to the ClearEOL() function, which only clears one row,
  2855.     ClearScreen deletes the entire RastPort from the current graphic
  2856.     cursor position.
  2857.     
  2858.     See: ClearEOL(), Move()
  2859.     
  2860.     ------------------------------------------------------------------
  2861.     
  2862. ClipBlit(&SourceRastPort,X1,Y1,&TargetRastPort,X2,Y2,Width,Height,
  2863.       Minterm)
  2864.     
  2865.     This function performs exactly the same function as BltBitMap().
  2866.     Most of the parameters have the same meaning. But with this function
  2867.     we blit from one RastPort to another and any overlapping problems 
  2868.     are handled by the routine.
  2869.     
  2870.     This function is much better because it is easy to use (you do not
  2871.     have to reserve a buffer) and it prevents you from creating any 
  2872.     error conditions. Blitting over the border of a RastPort does not
  2873.     create the problems possible with BltBitMap().
  2874.     
  2875.     See: BltBitMap(), BltBitMapRastPort()
  2876.     
  2877.     ------------------------------------------------------------------
  2878.     
  2879. CloseFont(&TextFont)
  2880.     
  2881.     When you have opened a font with OpenFont() or OpenDiskFont() you
  2882.     must also close it again before ending your program. Otherwise the
  2883.     memory used by your font is not released back to the system.    
  2884.     
  2885.     See: OpenFont()
  2886.     
  2887.                 PAGE 533
  2888.  
  2889. -----------------------------------------------------------------------------
  2890.     
  2891. DisownBlitter()
  2892.     
  2893.     This function releases the blitter from your control and allows
  2894.     other programs to use it again.
  2895.     
  2896.     See: OwnBlitter()
  2897.     
  2898.     ------------------------------------------------------------------
  2899.  
  2900. DoCollision(&RastPort)
  2901.     
  2902.     This routine tests all GELs in the GEL list for a RastPort, for 
  2903.     collisions and also executes any collision routines you have set up
  2904.     with SetCollision().
  2905.     
  2906.     However, we must inform you that DoCollision() does not function all 
  2907.     the time.
  2908.     
  2909.     See: SetCollision.
  2910.     
  2911.     ------------------------------------------------------------------
  2912.     
  2913. Draw(&RastPort,x,y)
  2914.     
  2915.     This is one of the most important graphic functions. DRAW allows 
  2916.     you to draw a line from the current graphic cursor position to the 
  2917.     selected X/Y coordinate in the specified RastPort.
  2918.     
  2919.     See: Move()
  2920.     
  2921.     ------------------------------------------------------------------
  2922.     
  2923. DrawEllipse(&RastPort, XMiddle, YMiddle, XRadius, YRadius)
  2924.     
  2925.     This function allows you to draw ellipses or, with XRadius = 
  2926.     YRadius, circles. These are not filled as with AreaEllipse; only 
  2927.     the outline is drawn.
  2928.     
  2929.     Remember that XRadius and YRadius must contain values that are 
  2930.     greater than zero.
  2931.     
  2932.                 PAGE 534
  2933.     
  2934. -----------------------------------------------------------------------------
  2935.  
  2936. DrawGList(&RastPort,&ViewPort)
  2937.     
  2938.     DrawGList() performs two functions. First it can draw the bobs, from 
  2939.     the GEL list in the selected RastPort. Second, it can link the 
  2940.     vsprites, from the ViewPort copper list, with the Selected ViewPort.
  2941.  
  2942.     However, vsprites are not drawn after calling DrawGList(). First 
  2943.     you have to use MakeVPort() or MakeScreen() to set up the new Copper
  2944.     list. Then you use MrgCop() and LoadView() or RethinkDisplay to 
  2945.     display them.
  2946.     
  2947.     See: MakeVPort(), MrgCop(), LoadView(), MakeScreen(), 
  2948.          RethinkDisplay()
  2949.  
  2950.     ------------------------------------------------------------------
  2951.     
  2952. Flood(&RastPort, Mode, x, y)
  2953.     
  2954.     This function enables you to fill an area in a RastPort. All the 
  2955.     pixels around the area from the specified X/Y positions are tested 
  2956.     and filled according to the mode selected. Mode = 0 tests for the 
  2957.     colour of the  Open and mode=1 tests for the color of the starting
  2958.     pixel.
  2959.     
  2960.     Any pixels around your starting point that dont meet the 
  2961.     requirements of either mode are filled with the current fill 
  2962.     pattern. When the pixel meets one of the mode criteria it is not
  2963.     changed.
  2964.     
  2965.     When all pixels within a closed border meet the mode criteria and 
  2966.     are already filled, the fill is cancelled.
  2967.     
  2968.     Remember that for the Flood() function a TmpRas structure must be
  2969.     initialised and must have enough memory  to be used by the Flood()
  2970.     function.
  2971.     
  2972.     See: InitTmpRas()
  2973.     
  2974.     ------------------------------------------------------------------
  2975.     
  2976. FreeColorMap(&ColorMap)
  2977.     
  2978.     You use this function to release the memory, which was reserved 
  2979.     through GetColorMap() for the ColorMap structure, back to the 
  2980.     system.
  2981.     
  2982.     See: GetColorMap()
  2983.     
  2984.                 PAGE 535
  2985.     
  2986. -----------------------------------------------------------------------------
  2987.  
  2988. FreeCopList(&CopList)
  2989.  
  2990.     Call this routine in order to release a single intermediate Copper
  2991.     list for a ViewPort (struct CopList), which was created by using 
  2992.     MakeVPort(). FreeVPortCopList() uses this routine to release all
  2993.     intermediate lists from a ViewPort.
  2994.  
  2995.     See: FreeVPortCopList()
  2996.  
  2997.     ------------------------------------------------------------------
  2998.  
  2999. FreeCprList(&cprlist)
  3000.  
  3001.     Use this function to release the memory reserved, through 
  3002.     View.LOFCprList and View.SHFCprList, for the hardware Copper list.
  3003.     These hardware copper lists are calculated from the individual 
  3004.     ViewPort Copper lists by using MrgCop().
  3005.  
  3006.     See: MrgCop()
  3007.  
  3008.     ------------------------------------------------------------------
  3009.  
  3010. FreeRaster(&BitPlane, Width, Height)
  3011.  
  3012.     This function produces the opposite effect of AllocRaster(). It 
  3013.     releases all reserved bitplane memory, that was allocated with
  3014.     AllocRaster(), back to the system. This makes the memory available
  3015.     to other programs again.
  3016.  
  3017.     BitPlane points to the memory area that you reserved with 
  3018.     AllocRaster. Width and Height must be the same for free and 
  3019.     AllocRaster(), otherwise it is possible to release too much or too
  3020.     little memory.
  3021.     
  3022.     See: AllocRaster()
  3023.  
  3024.     ------------------------------------------------------------------
  3025.  
  3026. FreeSprite(SprNumber)
  3027.  
  3028.     With FreeSprite you can release a sprite, that was reserved 
  3029.     specifically for your through GetSprite() back to the system.
  3030.     This makes the sprite available again for full system use 
  3031.     (especially the vsprites).
  3032.  
  3033.     You just provide the number of the sprite that was reserved with
  3034.     GetSprite().
  3035.     
  3036.                 PAGE 536
  3037.  
  3038. ----------------------------------------------------------------------------
  3039.  
  3040.     See: GetSprite(), ChangeSprite(), MoveSprite()
  3041.  
  3042.     ------------------------------------------------------------------
  3043.  
  3044. FreeVPortCopLists(&ViewPort)
  3045.  
  3046.     With this function you can release, for the specified ViewPort that
  3047.     you generated with MakeVPort(), all the Copper lists for the 
  3048.     colour, display, sprites etc...
  3049.     
  3050.     See: MakeVPort(), FreeCopList()
  3051.  
  3052.     ------------------------------------------------------------------
  3053.  
  3054. *ColorMap = GetColorMap(NumberColors)
  3055.  
  3056.     This function create a complete ColorMap structure. All of the 
  3057.     required ColorMap structure variables are initialised and enough
  3058.     memory is reserved for the specified NumberColors. When sufficient
  3059.     memory is not available for the new ColorMap structure or color
  3060.     buffer, a ZERO(0) is returned by the routine.
  3061.     
  3062.     You must link this ColorMap structure to the ViewPort with 
  3063.     ViewPort.ColorMap = ColorMap(before using MakeVPort() to calculate
  3064.     the Copper list for the ViewPort).
  3065.  
  3066.     See: FreeColorMap(), LoadRGB4(), GetRGB4(), SetRGB4()
  3067.  
  3068.     ------------------------------------------------------------------
  3069.  
  3070. Color = GetRGB4(&ColorMap,ColorRegister)
  3071.  
  3072.     This function enables you to retrieve the UWORD that determines 
  3073.     the color of the selected color register. The 16 bit UWORD 
  3074.     which is returned is divided as follows: bits 0-3 are the blue 
  3075.     component, bits 4-7 the green and bits 8-11 red.
  3076.     
  3077.     See: SetRGB4(), LoadRGB4()
  3078.     
  3079.     ------------------------------------------------------------------
  3080.     
  3081. SprNumber = GetSprite(&SimpleSprite,getSprNumber)
  3082.     
  3083.     This function allows you to reserve any hardware sprite for your
  3084.     personal use. You provide the SimpleSprite structure, that the
  3085.     sprite will be associated with, to the function. Also, select the
  3086.     desired number (0-7) (if it doesnt matter a -1) of the reserved
  3087.     sprite.
  3088.     
  3089.     The number of the reserved is returned is returned in the 
  3090.     SpriteNumber. If the selected sprite is not available, SpriteNumber
  3091.     contains a -1.
  3092.  
  3093.     See: FreeSprite(), MoveSprite(), FreeSprite()
  3094.     
  3095.                 PAGE 537
  3096.  
  3097. -----------------------------------------------------------------------------
  3098.  
  3099. InitArea(&AreaInfo,&Buffer,NumCoord)
  3100.  
  3101.     This function initialises the selected AreaInfo structure for you.
  3102.     The structure contains the specified Buffer and the NumCoord+1
  3103.     coordinates required for AreaDraw() and AreaMove(). The buffer 
  3104.     should contain at least five time the number of bytes that are
  3105.     required for the polygon coordinates which are used with AreaMove()
  3106.     and AreaDraw().
  3107.     
  3108.     Declaring the buffer as a char array is the easiest method. Since
  3109.     programs created with the compiler automatically releases arrays,
  3110.     you dont have to release the used buffer area again.
  3111.  
  3112.     See: AreaDraw(), AreaMove(), AreaEnd()
  3113.  
  3114.     ------------------------------------------------------------------
  3115.  
  3116. InitBitMap(&BitMap, Depth, Width, Height)
  3117.  
  3118.     This routine initialises the specified BitMap structures. The
  3119.     depth (number of bitplanes), width (in pixels), and the height
  3120.     (in rows) is easily set.
  3121.     
  3122.     See: AllocRaster()
  3123.  
  3124.     ------------------------------------------------------------------
  3125.  
  3126. InitGels(&Begin, &End, &GelsInfo)
  3127.     
  3128.     This function initialises the selected GelsInfo structure. You need
  3129.     this structure in order to display vsprites and bobs in an organised
  3130.     manner.
  3131.  
  3132.     All the graphic elements (=GEL) are linked in a list through the
  3133.     vsprite structures (&Begin, &End). &Begin and &End mark the 
  3134.     beginning and end of this GEL list.
  3135.  
  3136.     After you have used InitGels() to initialise the GelsInfo structure,
  3137.     then simply make them available to your RastPort (RastPort.GelsInfo =
  3138.     &GelsInfo). Once this is accomplished, you can start displaying 
  3139.     your bobs and vsprites.
  3140.     
  3141.     
  3142.     See: AddVSprite, AddBob()
  3143.  
  3144.                 PAGE 538
  3145.  
  3146. -----------------------------------------------------------------------------
  3147.  
  3148. InitMasks(&VSprite)
  3149.  
  3150.     You initialise the BorderLine and CollMask for the specified 
  3151.     vsprite structure with this routine. The memory buffer for both
  3152.     masks must be reserved already and stored in the variables 
  3153.     VSprite.BorderLine and VSprite.CollMask.
  3154.  
  3155.     ------------------------------------------------------------------
  3156.  
  3157. InitRastPort (&RastPort)
  3158.  
  3159.     You use this routine to initialise the specified RastPort 
  3160.     structure. This RastPort structure is the most important connection
  3161.         between the user and BitMap.
  3162.  
  3163.     The RastPort contains, for example, the color of the current 
  3164.     foregroundpen(APen). It also contains a pointer to the bitmap 
  3165.     where the graphic functions will be executed and many other 
  3166.     important variables and pointers used by the graphic functions.
  3167.  
  3168.     ------------------------------------------------------------------
  3169.  
  3170. TmpRas = InitTmpRas(&TmpRas,&Buffer,BufferSize)
  3171.  
  3172.     When you use the Area...() functions within a RastPort, an extra
  3173.     memory area is required for these functions. This buffer must be
  3174.     at least as large as the object being filled. Because of the 
  3175.     recursive algorithm used by fill, extra memory is required as
  3176.     workspace.
  3177.  
  3178.     This buffer only requires one bitplane which is as large as the 
  3179.     largest element. To ensure that you have enough, it is best to 
  3180.     reserve one complete bitplane for the temporary raster.
  3181.  
  3182.     Now simply pass the initialised TmpRas structure to your RastPort.
  3183.     There are two possible ways to do this. You can either use the 
  3184.     result returned by the initialised TmpRas structure (RastPort.
  3185.     TmpRas= InitTmpRas (....)) or pass the initialised TmpRas structure
  3186.     yourself (RastPort.TmpRas = &TmpRas).
  3187.  
  3188.                 PAGE 539
  3189.  
  3190. -----------------------------------------------------------------------------
  3191.  
  3192. InitView(&View)
  3193.  
  3194.     This function is used to initialise the specified View structure.
  3195.     All variables and pointers  for the View structure are first set
  3196.     to zero. Then the DxOffset and DyOffset variables are set so that
  3197.     the View is positioned approximately two centimetres below the top
  3198.     right monitor border. This assumes that the monitor is properly    
  3199.     adjusted.
  3200.  
  3201.     See: MrgCop(), MakeVPort()
  3202.  
  3203.     ------------------------------------------------------------------
  3204.  
  3205. InitVPort(&ViewPort)
  3206.  
  3207.     This function is used to clear all variables and pointers for the
  3208.     selected ViewPort structure. This is done so that the individual
  3209.     Copper lists for this ViewPort will be correctly calculated with
  3210.     MakeVPort(). When a pointer to a ViewPort Copper list is not equal
  3211.     to zero, MakeVPort() assumes that a ViewPort Copper list exists
  3212.     and does not calculate a new one.
  3213.  
  3214.     Undefined Copper lists could be created without this MakeVPort()
  3215.     feature.
  3216.  
  3217.     See: MakeVPort()
  3218.  
  3219.     ------------------------------------------------------------------
  3220.  
  3221. LoadRGB4(&ViewPort,&Colotpalette[0],Colorentry)
  3222.  
  3223.     This routine allows you to load new colour values, ColorEntry from 
  3224.     the ColorPalette (UWORD Colorpalette[Colorentry];) into the 
  3225.     ColorMap for the selected windows.
  3226.  
  3227.     Using this routine is an easy way to change all the colours of a 
  3228.     ViewPort at one time. However, the change is not immediate. First
  3229.     you have to calculate a new color Copper list for the ViewPort. You
  3230.     do this with MakeVPort(), MrgCop() and then LoadView(). When using
  3231.     intuition screns substitute RemakeDisplay() for LoadView().
  3232.  
  3233.     See: SetRGB4(), GetRGB4()
  3234.  
  3235.                 PAGE 540
  3236.  
  3237. -----------------------------------------------------------------------------
  3238.  
  3239. LoadView(&View)
  3240.  
  3241.     After calling this function, the selected View and all ViewPorts
  3242.     it contains are displayed on the screen. You must first use 
  3243.     MakeVPort() for each ViewPort that will be displayed in the View.
  3244.     MakeVPort() creates the ViewPort Copper lists that MrgCop() merges
  3245.     into a single View Copper list.
  3246.  
  3247.     The View Copper list starting address is written by LoadView() in 
  3248.     the necessary hardware registers (cop11c, cop21c).
  3249.  
  3250.     See: InitView(), InitVPort(), MakeVPort(), MrgCop()
  3251.  
  3252.     ------------------------------------------------------------------
  3253.  
  3254. MakeVPort(&View,&ViewPort)
  3255.  
  3256.     This routine calculates the intermediate ViewPort Copper lists for
  3257.     the selected ViewPort of the specified View. For example, there are
  3258.     ViewPort Copper lists for color display for all colors which are
  3259.     written through the Copper to the hardware registers. These color
  3260.     copper lists are calculated from the ViewPort colormap. When the 
  3261.     color list pointer is equal to zero, the default ColorMap is
  3262.     used to calculate the ViewPort color Copper list.
  3263.  
  3264.     These lists also contain the various resolution modes for the 
  3265.     ViewPorts (many ViewPorts in one View can have different 
  3266.     resolutions).
  3267.  
  3268.     See: MrgCop(), FreeVPortCopLists()
  3269.  
  3270.     ------------------------------------------------------------------
  3271.  
  3272. Move(&RastPort,X,Y)
  3273.  
  3274.     You use this function to position the graphic cursor for the 
  3275.     selected RastPort to the specified position (RastPort.cp_x = x;
  3276.     RastPort.cp_y = y;)
  3277.  
  3278.     At this position you could print text or draw a line to another
  3279.     position.
  3280.  
  3281.     ------------------------------------------------------------------
  3282.  
  3283. MoveSprite(&ViewPort,&SimpleSprite, X,Y)
  3284.  
  3285.     This function lets you position the selected hardware sprites within
  3286.     the selected ViewPort when ViewPort is not equal to zero. Otherwise,
  3287.     the sprite will be positioned relative to the View.
  3288.  
  3289.     X and Y specify the new position. Remember that the position values
  3290.     in hi-res or lace ViewPorts must be multiplied by two so that the
  3291.     sprite actually moves.
  3292.  
  3293.     See: ChangeSprite(), GetSprite(), FreeSprite()
  3294.  
  3295.                 PAGE 541
  3296.  
  3297. -----------------------------------------------------------------------------
  3298.  
  3299. MrgCop&(View)
  3300.  
  3301.     This function calculates the View hardware Copper list from the 
  3302.     ViewPort Copper lists created with MakeVPort(). Then this list is
  3303.     used by the hardware(cop11c,cop21c).
  3304.     
  3305.     Any change to the colortable or the hardware sprite positions 
  3306.     requires a newly calculated copper list. This happens automatically
  3307.     when the hardware sprites are moved. When changing the colorpalette
  3308.     with LoadRGB4() you must update the Copper list.
  3309.  
  3310.     See: MakeVPort(), FreeCprList()
  3311.  
  3312.     ------------------------------------------------------------------
  3313.  
  3314. *TextFont = OpenFont(&TextAttr)
  3315.  
  3316.     This function searches through the SystemFontList for a font 
  3317.     described by the TextAttr structure. When a font cannot be found
  3318.     to match the named TextAttr structure, a value of zero is returned.
  3319.     However, when a font is found but has different styles or sizes, a 
  3320.     font that best meets the specifications is selected.
  3321.  
  3322.     OpenFont() increases user choices when accessing the Systemfonts.
  3323.     OpenFont() and CloseFont() must maintain a balance in order to 
  3324.     guarantee a clean memory. When a font is no longer required you 
  3325.     can remove it from memory with  RemFont().
  3326.     
  3327.     See: CloseFont(), AddFont(), RemFont(), OpenDiskFont(),
  3328.          AvailFonts().
  3329.  
  3330.     ------------------------------------------------------------------
  3331.  
  3332. OwnBlitter()
  3333.  
  3334.     This function informs the Blitter that it is only able to work 
  3335.     for you. Other tasks (programs) that are running at the same time
  3336.     can no longer use the blitter.
  3337.  
  3338.     After OwnBlitter(), you should use WaitBlit() to allow the Blitter 
  3339.     to complete any current processing.
  3340.  
  3341.     See: DisownBlitter(), WaitBlit()
  3342.  
  3343.                 PAGE 542
  3344.  
  3345. ----------------------------------------------------------------------------
  3346.  
  3347. PolyDraw(&RastPort.NumCoords, &PixelArray)
  3348.  
  3349.     This routine enables you to draw into the selected RastPort by 
  3350.     using coordinates from any array you created. Lines are drawn from 
  3351.     pixel to pixel as plotted from the array.
  3352.  
  3353.     THe pixels are stored in an integer array (int PixelArray    
  3354.     [NumCoords][2]) with each coordinate consisting of two array 
  3355.     elements. The first element is the X and the second is the Y 
  3356.     coordinate for the stored polygon pixels
  3357.  
  3358.     NumCoords specifies the number of pixels that will be drawn from 
  3359.     the pixel array.
  3360.  
  3361.     ------------------------------------------------------------------
  3362.  
  3363. ColorRegister = ReadPixel(&RastPort, X, Y)
  3364.  
  3365.     This function allows you to read the color value of a specific
  3366.     pixel at the coordinates you selected.
  3367.  
  3368.     When your coordinates are outside the selected RastPort, a value
  3369.     of -1 is returned in ColorRegister.
  3370.  
  3371.     See: WriteAPen(), SetAPen()
  3372.  
  3373.     ------------------------------------------------------------------
  3374.         
  3375. RectFill(&RastPort, X1, Y1, X2, Y2)
  3376.  
  3377.     With this function you can fill any desired rectangular area within
  3378.     the selected RastPort. The current fill pattern, Drawmodes, APens,
  3379.     etc.. affect how your fill is performed.
  3380.     
  3381.     You just specify the top left corner (X1,Y1) and the lower right
  3382.     corner (X2,Y2) of the rectangle you want filled. Make sure that
  3383.     the lower right corner really is lower and to the right of the 
  3384.     upper left corner. When your coordinates are incorrect the computer
  3385.     can crash because your memory will be filled without the proper
  3386.     controls.
  3387.  
  3388.                 PAGE 543
  3389.  
  3390. -----------------------------------------------------------------------------
  3391.  
  3392.     This function does not require a TmpRas structure like the Flood()
  3393.     and Area...() functions.
  3394.  
  3395.     ------------------------------------------------------------------
  3396.  
  3397. RemFont(&TextFont)
  3398.  
  3399.     This function removes the selected font from the system font list.
  3400.     The font remains available to any programs currently using it.
  3401.     After all programs signal, with CloseFont(), that this font is no 
  3402.     longer required, the font is pysically removed from memory.
  3403.     
  3404.     After you have used RemFont() a program that has used CloseFont()
  3405.     cannot access the font again.
  3406.     
  3407.     See: AddFont(); OpenFont(); CloseFont()
  3408.  
  3409.     ------------------------------------------------------------------
  3410.     
  3411. RemIBob(&Bob, &RastPort, &ViewPort)
  3412.     
  3413.     This function immediately removes the selected bob from the GEL,
  3414.     list for in RastPort and deletes it from the RastPort.
  3415.     
  3416.     See: DrawGList(), SortGList(), InitGels()
  3417.  
  3418.     ------------------------------------------------------------------
  3419.  
  3420. RemVSprite(&VSprite)
  3421.  
  3422.     This routine deletes the selected vsprite from the current GEL 
  3423.     list. However, the sprite does not immediately dissappear from the
  3424.     screen. This occurs only after the calls to SortGList(), DrawGList(),
  3425.     MakeVPort(), MrgCop(), LoadView().
  3426.  
  3427.     See: DrawGList(), SortGList()
  3428.  
  3429.     ------------------------------------------------------------------
  3430.  
  3431. ScrollRaster(&RastPort, DeltaX, DeltaY, X1, Y1, X2, Y2)
  3432.     
  3433.     This function scrolls the rectangle, specified by X1, Y1, X2, Y2
  3434.     (see RectFill), for DeltaX pixels and DeltaY rows. Positive delta
  3435.     values scroll up and left. Negative delta values scroll right and
  3436.     down. Combatting negative and positive 'Delta' values allows you
  3437.     to scroll in any desired direction.
  3438.     
  3439.                 PAGE 544
  3440.     
  3441. -----------------------------------------------------------------------------
  3442.  
  3443.     The areas uncoverd by the scrolled rectangle are filled with the
  3444.     color of the BPen.
  3445.     
  3446.     Please note that this routine is not very fast and can cause some
  3447.     flickering during the scrolling.
  3448.  
  3449.     ------------------------------------------------------------------
  3450.  
  3451. ScrollVPort(&ViewPort)
  3452.  
  3453.     After you have changed the RxOFfset and RyOffset values in the 
  3454.     RasInfo structure of the ViewPort, use ScrollVPort() to display
  3455.     a different portion of the bitmap. ScrollVPort calculates the 
  3456.     new copper list for the new bitmap position.
  3457.  
  3458.     This routine is not fast enough to prevent some flickering on the
  3459.     screen. Because of this, you should calculate the new Copper list
  3460.     since this can be performed as a background process.
  3461.  
  3462.     ------------------------------------------------------------------
  3463.  
  3464. SetAPen(&RastPort,Colorregister)
  3465.  
  3466.     This function allows you to select, in the selected RastPort, a new
  3467.     color for the APen.ColorRegister selected the number of the colour
  3468.     register in the ViewPort ColorMap.
  3469.  
  3470.     See: SetBPen()
  3471.     
  3472.     ------------------------------------------------------------------
  3473.     
  3474. SetBPen(&RastPort,ColorRegister)
  3475.  
  3476.     Just like SetAPen, the color of the BPen is changed in the selected
  3477.     RastPort. Again, ColorRegister specifies the number of the color
  3478.     register to be used from this point on.
  3479.     
  3480.     APen and BPen functions differently depending on which drawing mode
  3481.     you are using. With JAM2 mode, the BPen functions as the background
  3482.     color pen. For example, text would be highlighted with the BPen.
  3483.     The BPen has no effect in other draw modes.
  3484.         
  3485.     See: SetAPen()
  3486.         
  3487.                 PAGE 545
  3488.  
  3489. -----------------------------------------------------------------------------
  3490.     
  3491. SetCollision(Number, Routine, &GelsInfo)
  3492.     
  3493.     After comparing the MeMask and HitMask, this function sets the 
  3494.     collisions routines that are used for collisions between GELs or
  3495.     a GEL with a border.
  3496.  
  3497.     With GEL to GEL collisions you must pass both vsprite structures to
  3498.     your collision routine. The first vsprite structure passed 
  3499.     represents the upper left positioned GEL (bob or vsprite).
  3500.  
  3501.     With border collisions, you pass the involved vsprite structure
  3502.     and a flag to your routine. The flag contains the code for the
  3503.     border (TOPHIT, BOTTOMHIT, LEFTHIT, RIGHTHIT) the GEL collided
  3504.     with.
  3505.     
  3506.     See: DoCollision()
  3507.     
  3508.     ------------------------------------------------------------------
  3509.  
  3510. SetDrMd(&RastPort, Mode)
  3511.  
  3512.     Use this function to set the DrawMode for your RastPort. This sets
  3513.     up how lines are drawn, how pixels are set and how text is 
  3514.     displayed. The following modes exist:
  3515.  
  3516.     JAM1 (0): Only the APen colour is used for drawing.
  3517.     JAM2 (1): The BPen colour is used for the background.
  3518.     COMPLEMENT(2): Pixels to be drawn are first XORed with the 
  3519.                existing pixels (by bitplane).
  3520.     INVERSVID(4) : Pixels are inverted before being drawn (by bitplane).
  3521.     
  3522.     The modes COMPLEMENT and INVERSVID only function with JAM1 or 
  3523.     JAM2.
  3524.  
  3525.     ------------------------------------------------------------------
  3526.  
  3527. SetFont(&RastPort,&Font)
  3528.  
  3529.     SetFont() makes a font available to the selected RastPort. This 
  3530.     font should have alreay been opened with OpenFont() or
  3531.     OpenDiskFont(). Any text you know output with Text() will appear 
  3532.     in the new font.
  3533.  
  3534.     See: OpenFont(), CloseFont()
  3535.  
  3536.                 PAGE 546
  3537.  
  3538. ----------------------------------------------------------------------------
  3539.  
  3540. SetRast(&RastPort, Colorregister)
  3541.  
  3542.     This function sets all pixels in the selected RastPort bitmap, to 
  3543.     the color of the colour register from the ViewPort's colormap
  3544.     for this RastPort.
  3545.     
  3546.     When ColorRegister equals zero, then all the pixels of the ViewPort's
  3547.     ColorMap are cleared to colour zero (= background color).
  3548.  
  3549.     ------------------------------------------------------------------
  3550.     
  3551. SetRGB4CM(&ColorMap, Colorregister, Red, Green, Blue)
  3552.     
  3553.     This function works similar to SetRGB4. However, the color change 
  3554.     is not immediately visible. This happens only after you 
  3555.     calculate the Copper list again with RemakeDisplay.
  3556.  
  3557.     The colour change first occurs in the selected colormap before it 
  3558.     is allowed to be visible.
  3559.     
  3560.     Like LoadRGB4, the colormap is initialised with new values in the
  3561.     background.
  3562.     
  3563.     See: LoadRGB4()
  3564.     
  3565.     ------------------------------------------------------------------
  3566.  
  3567. SetRGB4(&ViewPort, ColorRegister, Reg, Green, Blue)
  3568.     
  3569.     This function allows you to change the color of one color register
  3570.     in the specified ViewPort. You pass the number of the color register
  3571.     and the new red, green and blue components (0-15) for the new
  3572.     color value.
  3573.  
  3574.     SetRGB4() also changes the color entry in the ColorMap structure of
  3575.     the ViewPort amd in the Copper list. This colour change is 
  3576.     immediately visible on the screen.
  3577.     
  3578.     See: LoadRGB4(), GetRGB4()
  3579.  
  3580.                 PAGE 547
  3581.  
  3582. -----------------------------------------------------------------------------
  3583.  
  3584. NewStlye = SetSoftStyle(&RastPort, FontStyle, Style)
  3585.  
  3586.     This function sets your desired, algorithmically generated font
  3587.     style in the selected RastPort. You set the desired style in 
  3588.     FontStyle (see AskSoftStyle()) and use the value returned by 
  3589.     AskSoftStyle in Style. AskSoftStyle() provides the available 
  3590.     styles that can be used for the Style variable. For example,
  3591.     it is possible that a font is already italic and after 
  3592.     AskSoftStyle() provided that information, it would be useless
  3593.     to try to make that font italic.
  3594.     
  3595.     SetSoftStyle() changes a font only when the style-bits are also 
  3596.     set in Style. After the change, NewStyle contains the font 
  3597.     generated by SetSoftStyle().
  3598.     
  3599.     See: AskSoftStyle()
  3600.     
  3601.     ------------------------------------------------------------------
  3602.  
  3603. SortGList(&RastPort)
  3604.  
  3605.     This routine sorts the GEL list of the selected RastPort. The
  3606.     vsprite structures used for positioning vsprites and bobs are 
  3607.     sorted by their Y and X coordinates. The sort is performed by the
  3608.     Y and then by the X coordinate.
  3609.     
  3610.     After using SortGList() you use DrawGList() to display the GEL
  3611.     list again.
  3612.     
  3613.     See: DrawGList()
  3614.     
  3615.     ------------------------------------------------------------------
  3616.     
  3617. Text(&RastPort, &"string", NumCharacters)
  3618.     
  3619.     This routine lets you display, at the graphic cursor position, any
  3620.     desired text in the selected RastPort. You simply provide the 
  3621.     starting address of the output string and the number of characters
  3622.     to be displayed.
  3623.     
  3624.     See: TextLength()
  3625.     
  3626.     ------------------------------------------------------------------
  3627.     
  3628. Length = TextLength(&RastPort, &"String", NumCharacters)
  3629.  
  3630.     This function has the same parameters as Text(). The length in 
  3631.     pixels for the text string is returned and the RastPorts currently
  3632.     active font is used to display the text.
  3633.     
  3634.                 PAGE 548
  3635.  
  3636.     See: Text(), SetFont()
  3637.     
  3638. -----------------------------------------------------------------------------
  3639.  
  3640. Position = VBeamPos()
  3641.     
  3642.     This function returns the current vertical position of the 
  3643.     electronic raster beam in "position". The values that are returned
  3644.     fall between 0 and 255 on PAL systems. Because the electron beam
  3645.     actually scans 262 lines on PAL systems, the positions between
  3646.     256 and 262 are returned as values between zero and 6.
  3647.  
  3648.     After your program has received it, the value returned by 
  3649.     VBeamPos() is usually useless. Due to the Amiga's multitasking
  3650.     capabilities, the millisecond reaction time, required by your
  3651.     program to react, can be used up by another program or task.
  3652.  
  3653.     ------------------------------------------------------------------
  3654.  
  3655. WaitBlit()
  3656.     
  3657.     This function pauses your program until the blitter has completed
  3658.     its task. Be careful because a processor error can cause WaitBlit()
  3659.     to return actually before completing the desired task. Your program
  3660.     is then able to continue its tasks before they should occur.
  3661.     Most often, this error occurs when you are using hires with 
  3662.     four bitplanes.
  3663.  
  3664.     ------------------------------------------------------------------
  3665.  
  3666. WaitBOVP(&ViewPort)    
  3667.     
  3668.     This function pauses your program until the electron beam reaches 
  3669.     the last row of the selected ViewPort (Bottom of ViewPort).
  3670.     
  3671.     See: WaitTOF()
  3672.     
  3673.     ------------------------------------------------------------------
  3674.  
  3675. WiatTOF()
  3676.  
  3677.     This function is similar to WaitTOF() except that the pause doesnt
  3678.     happen until the end of the ViewPort. WaitTOF() waits for the 
  3679.     electronic beam to reach "Vertical Blank" (top of frame) or the
  3680.     start of a new scan after completing any cyclic routines 
  3681.     (Interrupts)
  3682.     
  3683.     See: WaitBOVF()
  3684.     
  3685.                 PAGE 549
  3686.     
  3687. -----------------------------------------------------------------------------
  3688.  
  3689. WritePixel(&RastPort,x,y)
  3690.  
  3691.     This function sets a pixel at coordinates X and Y, in the APen
  3692.         colour in the selected RastPort. Naturally, the current drawing 
  3693.     mode of the RastPort is used.
  3694.  
  3695.     See: ReadPixel()
  3696.  
  3697. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  3698.  
  3699.                              DISKFONTBASE
  3700.                  ============
  3701.  
  3702. Now to the DiskFontBase functions (you must first open the library 
  3703. "diskfont.libraries"
  3704.  
  3705.     ----------------------------------------------------------
  3706.     
  3707. Error = AvailFonts(&Buffer, BufferSize, Typ)
  3708.  
  3709.     This function provides a complete list of the available system 
  3710.     fonts. This list is written into the memory area (&Buffer),
  3711.     which contains the BuffserSize that you selected.
  3712.  
  3713.     The first thing stored in the buffer is the AvailFontsHeader. This
  3714.     contains the number of font entries that are stored (in 
  3715.     AvailFontsHeader.afh_NumEntries). Then the various AvailFonts 
  3716.     entries, which contain the type of font, (either in the system font
  3717.     list (AFF_MEMORY) or on disk (AFF_DISK) and the more descriptiive
  3718.     TextAttr structure are stored.
  3719.  
  3720.     The TextAttr structure can be used to open a font. However, this
  3721.     must be done by type (AFF_MEMORY / AFF_DISK) in order to open one
  3722.     with OpenFont() or OpenDiskFont().
  3723.  
  3724.     THe AvailFonts parameter TYP determines whether the Systemfontlist
  3725.     (AFF_MEMORY), SYS:Fonts (AFF_DISK) or both are searched for 
  3726.     available fonts.
  3727.     
  3728.     Please note that AvailFonts() does not verify the TextAttr structure
  3729.     contents for SYS:Fonts from disk. When you open fonts using
  3730.     OpenDiskFont() with the returned TextAttr structure of AvailFonts(),
  3731.     you can encounter such undesired results as a system crash.
  3732.  
  3733.     The results returned by AvailFonts() provide information on whether
  3734.     or not enough memory is available to store all the AvailFont
  3735.     structures. When error equals zero there is enough memory. However,
  3736.     when error is not equal to zero or the number of additional bytes
  3737.     that are required to contain all the AvailFonts structures is 
  3738.     returned instead.
  3739.  
  3740.                 PAGE 550
  3741.  
  3742. -----------------------------------------------------------------------------
  3743.  
  3744. *TextFont = OpenDiskFont(&TextAttr)
  3745.  
  3746.     This function opens a font described by the TextAttr structure.
  3747.     The SYS:Fonts directory is searched for a font that best matches
  3748.     the TextAttr structure in style and size. If a matching font in the
  3749.     TextAttr structure cannot be found, a value of zero is returned.
  3750.  
  3751.     See: OpenFont.
  3752.  
  3753. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  3754.  
  3755.                INTUITIONBASE
  3756.                =============
  3757.  
  3758. The following are the IntuitionBase routines (IntuitionBase is the 
  3759. pointer to the Intuition library that you open with IntuitionBase =
  3760. (struct IntuitionBase *) OpenLibrary("intuition.library",0)
  3761.  
  3762.         --------------------------------------------
  3763.  
  3764. CloseScreen(&Screen)
  3765.     
  3766.     Use this function to close a screen that was opened earlier with
  3767.     OpenScreen(). The memory used for the bitmap and all Intuition
  3768.     screen structures (ViewPort, RastPort etc..) is released.
  3769.  
  3770.     When you close the last user-opened screen, the workbench screen
  3771.     is automatically active again. CloseScreen() does not check 
  3772.     whether all windows for a screen have been closed. If any 
  3773.     windows are still open a system crash will occur.
  3774.  
  3775.     See: OpenScreen()
  3776.  
  3777.     -----------------------------------------------------------------
  3778.  
  3779. CloseWindow(&Window)
  3780.  
  3781.     This function closes a window you have opened with OpenWindow().
  3782.     Make sure that you close all the windows in a screen before 
  3783.     attempting to close the screen window.
  3784.  
  3785.     See: OpenScreen()
  3786.  
  3787.     ------------------------------------------------------------------
  3788.  
  3789. DisplayBeep(&Screen)
  3790.  
  3791.     This function blinks the screen by quickly changing the background
  3792.     color of the screen. This technique is used in order to make the
  3793.     user aware of small errors.
  3794.             
  3795.                 PAGE 551
  3796.  
  3797. -----------------------------------------------------------------------------
  3798.  
  3799.     By using a zero instead of a screen address you can blink all the
  3800.     Intuition screens. However, this should only be used to indicate
  3801.     a rather extreme user error.
  3802.  
  3803.     ------------------------------------------------------------------
  3804.  
  3805. MakeScreen(&Screen)
  3806.  
  3807.     This function executes MakeVPort() for the ViewPort of the specified
  3808.     screen. You can make changes to the intuition screens' ViewPorts
  3809.     (such as color changes with LoadRGB4() and inform the copper 
  3810.     afterwards).
  3811.  
  3812.     See: MakeVPort()
  3813.  
  3814.     ------------------------------------------------------------------
  3815.  
  3816. ModifyIDCMP(&Window,IDCMPFlags)
  3817.  
  3818.     This function is used to change the IDCMP flags (Intuition Direct
  3819.     Communication Message Ports) for a window. These flags are used
  3820.     for various messages that are sent by Intuition to your window.
  3821.     However, it is impossible to explain all the possibilities of the 
  3822.     IDCMP's in this Appendix.
  3823.  
  3824.     ------------------------------------------------------------------
  3825.  
  3826. OpenScreen(&NewScreen)
  3827.  
  3828.     This function opens an Intuition screen that is further described 
  3829.     by the selected NewScreen structure. This function creates a 
  3830.     ViewPort and all the other required structures (bitmap, RastPort, 
  3831.     etc..). The new screen is linked to the Intuition View and
  3832.     then displayed.
  3833.  
  3834.     See: CloseScreen().
  3835.  
  3836.     ------------------------------------------------------------------
  3837.  
  3838. RemakeDisplay()
  3839.  
  3840.     This funnction calculates a new Copper list for all intuition
  3841.     screens. This means that for each screen, a MakeScreen() and
  3842.     then a ReThinkDisplay() is called. When using this function,
  3843.     you should disable multi-tasking for a short time.
  3844.     
  3845.     See: MakeScreen(), ReThinkDisplay()
  3846.  
  3847.                 PAGE 552
  3848.  
  3849. -----------------------------------------------------------------------------
  3850.  
  3851. ReThinkDisplay()
  3852.  
  3853.     This function executes MrgCop() and LoadView() for the intuition
  3854.     View. Multitasking is turned off shortly while this is executing.
  3855.     
  3856.     See: MakeScreen(), RemakeDisplay(), MrgCop(), LoadView()
  3857.  
  3858. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  3859.  
  3860.  
  3861. Here are the DosBase routines (Please note that DosBase, just like the 
  3862. ExecBase, dont have to be opened because in these C programs they are 
  3863. always open).
  3864.  
  3865. Delay(Time)
  3866.  
  3867.     This routine pauses you program "Time" * 1/60 seconds. Other 
  3868.     running tasks are not paused as with a pause using for().
  3869.  
  3870.     ------------------------------------------------------------------
  3871.  
  3872. Exit(ReturnValue)
  3873.  
  3874.     This function allows you to exit a program loop at any time. When
  3875.     you run your program as an 'overlay-process', the "return value"
  3876.     is passed to your main process. We did not use the program overlay
  3877.     technique in our examlple programs.
  3878.  
  3879. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  3880.  
  3881. EXECBASE : The following are the execbase routines:
  3882.  
  3883. *Memory = AllocMem(NumBytes,Use)
  3884.  
  3885.     This routine is used to declare NumBytes of memory for your use.
  3886.     You must also specify what memory you require. When you use 
  3887.     MEMF_CHIP (MEMF = MEMoryFlag) the memory is allocated from the 
  3888.     lower 512K bytes area. This is especially important since this
  3889.     memory must be used by all the Amiga processors (for example,
  3890.     for bitplanes etc..)
  3891.  
  3892.     With MEMF_PUBLIC you use a memory area from anywhere. This can
  3893.     be an area above 512k bytes if you have more than 512K.
  3894.  
  3895.     MEMF_CLEAR allows you to immediately clear the selected memory 
  3896.     area. You will receive the address of a completely cleared memory
  3897.     area.
  3898.  
  3899.     See: FreeMem()
  3900.  
  3901.                 PAGE 553
  3902.  
  3903. -----------------------------------------------------------------------------
  3904.  
  3905. CloseLibrary(&BasePointer)
  3906.  
  3907.     Use this function to close a library you open earlier with 
  3908.     OpenLibrary(). Provide the address pointer that you received when 
  3909.     using OpenLibrary() in "BasePointer".
  3910.  
  3911.     Please make sure you close all open libraries before exiting     
  3912.     your program.
  3913.  
  3914.     See: OpenLibrary()
  3915.  
  3916.     ------------------------------------------------------------------
  3917.  
  3918. FreeMem(&Memory, Size)
  3919.  
  3920.     You use this routine to release a memory area that was reserved.
  3921.     Simply specify the starting address of the memory area and the 
  3922.     number of bytes reserved.
  3923.  
  3924.     See: AllocMem()
  3925.  
  3926.     ------------------------------------------------------------------
  3927.  
  3928. Message = GetMsg(&Port)
  3929.  
  3930.     By using this function you can intercept messages from Intuition.
  3931.     This function waits until a message is sent.
  3932.  
  3933.     See: AllocMem()
  3934.  
  3935.     ------------------------------------------------------------------
  3936.  
  3937. OpenLibrary(&LibName,Versionnumber)
  3938.  
  3939.     Use this function to open the selected library which gives you
  3940.     access to specific operating system routines.
  3941.  
  3942.     For example, to use the graphic functions, open the graphic library
  3943.     with GfxBase = (struct GfxBase *) OpenLibrary("graphics.
  3944.         library",0). GfxBase is the pointer to the requested library
  3945.     and must be used with CloseLibrary at the end of your program.
  3946.  
  3947.                 PAGE 554
  3948.  
  3949. -----------------------------------------------------------------------------
  3950.  
  3951.     When you dont know the actual version number of the library, use 
  3952.     zero, which uses the current library version. However, when a 
  3953.     function is available only in a specific version of a library,
  3954.     you should quickly exit your program is the library is not found.
  3955.  
  3956.     ------------------------------------------------------------------
  3957.  
  3958. ReplyMsg(&Port)
  3959.  
  3960.     Use this function to tell intuition, for example, that you have
  3961.     received and processed its messages.
  3962.  
  3963.                 PAGE 555
  3964.  
  3965. -----------------------------------------------------------------------------
  3966.  
  3967.             APPENDIX C - THE HARDWARE REGISTERS
  3968.             ===================================
  3969.  
  3970. This appendix provdes an overview of the Amiga hardware registers. Those
  3971. registers are useful with Copper programming because they can be easily
  3972. changed through the copper.
  3973.  
  3974. Use the CMOVE() instruction with the register number that you want to
  3975. change. If you want to change a register by using the 68000, you should
  3976. only write to specific memory areas.
  3977.  
  3978. THe hardware registers are located in a memory area starting at $DFF000.
  3979. This means that you must use this address as an offset and then add the
  3980. value of the specific register address in order to use the 68000 to
  3981. access it.
  3982.  
  3983. To access the hardware registers with C, use the Custom structure that 
  3984. you create with extern struct Custom custom. As with the Copper or
  3985. 68000, you can access the individual registers by using custom.Name.
  3986.  
  3987. The following list describes hardware registers in detail. We have 
  3988. provided the regsiter number as you would define them in your include
  3989. file hardware/custom.h. We also show the offset for each register from 
  3990. $DFF000. So, both C and machine language programmers have the background
  3991. information on the registers and how to use them.
  3992.  
  3993. -----------------------------------------------------------------------------
  3994.  
  3995. adkcon    $09E      Audio and disk control (write)
  3996. adkconr    $010    Audio and disk control (read)
  3997.  
  3998.     As shown, you access these registers differently. You can either 
  3999.     write (adkcn) to one, or read (adkconr) from the other.
  4000.  
  4001.     The bit structure of both registers is the same. However, even     
  4002.     though bit 15 is not affected by read operations, it is very 
  4003.     important for write operations.
  4004.  
  4005.     Bit 15 SET/CLR:
  4006.  
  4007.     When writing a word with this bit set, all bits (14-0) are written
  4008.     into the register. Any unset bits in the word being written do
  4009.     not change the corresponding bit already in the register.
  4010.  
  4011.                 PAGE 557
  4012.  
  4013. -----------------------------------------------------------------------------
  4014.  
  4015.     If bit 15 is unset in the word being written, all set bits of the
  4016.     written word clear any matching set bits in the register. Again,
  4017.     any unset register bits are unaffected.
  4018.  
  4019.     In order to clearly explain this, we have provided the following 
  4020.     short example: When writing the binary value %1111111111111110 all
  4021.     bits in the register are set except for zero. With a value of
  4022.     %0111111111111110 all bits in the register are cleared except bit
  4023.     zero. This type of register control appears very often. WheneverŠ    a CLR/SET bit is used, the above rules will apply.
  4024.  
  4025.     Bits 14,13  PRECOMP1/2:
  4026.     These bits set the PreComp for disk operations. The value %00 in 
  4027.     both registers selects zero ns (nanoseconds). A value of %01
  4028.     selects 140ns, %10 selects 280ns and %11 selects 560ns.
  4029.  
  4030.     Bit 12 MFMPREC:
  4031.     This bit selects the read format for a disk. If it is set, this
  4032.     bit selects the normal mfm format. When it is unset, the GCR
  4033.     format is selected as for Apple or Commodore 64 disks.
  4034.  
  4035.     Bit 11 UARTBRK:
  4036.     When this bit is set, all lines of the RS232 interface are set to
  4037.     zero (Universal Asynchronous Receiver/Transmitter Break).
  4038.  
  4039.     Bit 10 WORDSYNC:
  4040.     Setting this bit starts the data transfer over the DMA channel
  4041.     and each word read is synchronised with the word in DSKSYNC.
  4042.  
  4043.     Bit 9 MSBSYNC:
  4044.     This bit determines whether the high bit of a word is synchronised
  4045.     in GCR format.
  4046.  
  4047.     Bit 8 FAST
  4048.     This bit allows you to set the timing for reading a bit from disk.
  4049.     Setting this bit selects two microseconds, which is the required
  4050.     timing for the MFM format. A value of zero for this bit sets the 
  4051.     timing to four microseconds, which is the correct timing for
  4052.     GCR type formats. (Apple, Commodore 64).
  4053.  
  4054.     Bits 7-4 ATPER3-0:
  4055.     These bits allow you to modulate the sampling rate of the 
  4056.     inidividual audio channels. Setting ATPER3 stops the sound channel
  4057.     output. By setting ATPER2, you can modulate the sampling rate of 
  4058.     audio channel three with audio channel two. Setting ATPER1 
  4059.     modulates the sampling rate of audio channel two with audio channel
  4060.     one. ATPER0 sets the modulation sampling rate between audio 
  4061.     channels one and zero.
  4062.  
  4063.                 PAGE 558
  4064.  
  4065. -----------------------------------------------------------------------------
  4066.  
  4067. Bits 3-0 ATVOL3-0
  4068.     These bits determine the volume modulation of the individual audio 
  4069.     channels. The pattern used is the same as ATPER3-0 except that the
  4070.     volume is modulated.
  4071.  
  4072.     ------------------------------------------------------------------
  4073.  
  4074. aud[X].ac_ptr $0A0    Audio channel X start address.
  4075.  
  4076.     The address for the data that will be sent over the sound DMA 
  4077.     channel (direct memory access = without the use of 68000) is
  4078.     stored here.
  4079.     This is actually a register pair where the data address' lower 15
  4080.     bits are stored in $0A2 and the upper three bits are stored in 
  4081.     $0A0. Based on the custom declaration in the include file, the
  4082.     *ac_ptr is already reserved by the compiler as a long word.
  4083.  
  4084.     To directly access this register pair from the C language, you 
  4085.     must use an index value between 0 and 3 for the corresponding
  4086.     audio channel (aud[X]).
  4087.  
  4088.     Machine language programmers must always add X*12 words to access
  4089.     a specific sound channel register. This register pair and the 
  4090.     following five registers represent a block divided into four
  4091.     parts, one after the other. At the end of this Appendix we have
  4092.     provided a table showing all the register addresses relative to 
  4093.     $DFF000.
  4094.     
  4095.     Remember that here you can only use 18 bits for addressing. The
  4096.     sound chip, as with the Blitter, only uses the lower 512k bytes
  4097.     of memory.
  4098.  
  4099.     ------------------------------------------------------------------
  4100.  
  4101. aud[X].ac_len    $0A4    Audio channel X length.
  4102.  
  4103.     This register contains a count of the number of words to be sent 
  4104.     through the DMA channel for sound generation. You can set the 
  4105.     starting addres for these words in the register that is described
  4106.     above.
  4107.  
  4108.     ------------------------------------------------------------------
  4109.  
  4110. aud[X].ac_per    $0A6    Audio channel X sounding frequency.
  4111.     
  4112.     In this register you specify how many bytes per second are used for
  4113.     sound generation. Since the sound DMA channel is synchronised with
  4114.     the screen DMA channel, only two bytes per raster row can be made
  4115.     audible. Theoretically, it is possible to make two (bytes) * 
  4116.     262.5 (raster rows) * 59.94 (screen displayed) = 31468.5 bytes
  4117.     per second audible in PAL systems.
  4118.  
  4119.     Because the DMA controller is responsible for other tasks besides
  4120.     sound generation, it is only possible to sample 28867 bytes per
  4121.     second.
  4122.  
  4123.     This means that you could send one byte through the sound channel
  4124.     in 1/28867 seconds = 34.642 microseconds. This provides the value
  4125.     for this register: ac_per = 34.642 microseconds/Num_Microseconds 
  4126.     for one scan.
  4127.  
  4128.                 PAGE 559
  4129.  
  4130. -----------------------------------------------------------------------------
  4131.  
  4132.     The hardware determines the limits for the scan per timing cycle.
  4133.     Since the timing cycle is 280 nanoseconds or 0.28 microseconds, 
  4134.     a value of 123 (34.643 microseconds / 280 nanoseconds) is the 
  4135.     smallest possible value for this register. If you select a smaller
  4136.     value the DMA channel can no longer function properly. 
  4137.     ------------------------------------------------------------------
  4138.  
  4139. aud[X].ac_vol    $0A8    Audio channel X volume.
  4140.  
  4141.     Use this register to set your audio volume level for channel X.
  4142.     Only the lower five bits are essential to volume.
  4143.  
  4144.     The maximium volume level is 64; setting this register to zero
  4145.     turns off your sound.
  4146.  
  4147.     ------------------------------------------------------------------
  4148.     
  4149. aud[X].ac_dat    $0AA    Audio channel X data.
  4150.  
  4151.     This register is the audio DMA data buffer. If contains two bytes
  4152.     in two compliments which are sequentially sent through the sound
  4153.     hardware.
  4154.  
  4155.     The DMA controller automatically writes the values read from     
  4156.     ac_ptr into these registers. To create sound without using the DMA
  4157.     channels, you can write directly to these register by using the 
  4158.     68000. When doing this, make sure that you dont enable DMA access
  4159.     at the same time because this will disturb the interrupt timing.
  4160.  
  4161.     ------------------------------------------------------------------
  4162.  
  4163. bltXpt        $050    Blitter pointer.
  4164.  
  4165.     This register pair pointer contains an 18 bit pointer to the DMA
  4166.     data that the blitter will act upon. X represents a,b,c and d
  4167.     which are the three sources (a,b,c) and the target (d) for the 
  4168.     blitter operation (Blits).
  4169.  
  4170.     The data for a blit operation is read from bltapt, bltbpt and
  4171.     bltcpt; it is operation on and stored at bltdpt.
  4172.  
  4173.     When the blitter operation is complete, the pointer contains the
  4174.     last data address (plus increment and modulo) for the data written
  4175.     and read. To include the target (d) in the blit operation, one
  4176.     of the sources (a,b or c) must contain the same address as the 
  4177.     target (d).
  4178.  
  4179.     The blitter is not only responsible for blitting, but also for 
  4180.     drawing lines. Because this additional task is integrated into this
  4181.     processor, it is easy to understand why the amiga can draw lines
  4182.     so quickly.
  4183.  
  4184.                 PAGE 560
  4185.  
  4186. -----------------------------------------------------------------------------
  4187.  
  4188.     How the bltapt, bltbpt, bltcpt and bltdpt registers affect line
  4189.     drawing is not relevant here because the Draw() instruction was
  4190.     designed for this function.
  4191.  
  4192.     ------------------------------------------------------------------
  4193.  
  4194.  
  4195. bltXmod        $064    Blitter Modulo X
  4196.  
  4197.     This register contains the modulo for the Blitter sources (a,b and
  4198.     c) and the Blitter target (d). Since it is possible to use 
  4199.     different sized bitmaps, which we can blit between, we must know
  4200.     the size of each  bitmap that the Blitter will work with. A blit
  4201.     operation is not limited only to one bitmap.
  4202.  
  4203.     You must provide the width for each bitmap, that is used for the 
  4204.     blit operation as the modulo parameter. This is how a rectangle to
  4205.     be blitted is transferred from one bitmap to the other.
  4206.  
  4207.     Remember that the blitter can only operate on data by bitplane.
  4208.     This means that when you control the blitter yourself and blit
  4209.     a rectangle from one bitmap to another, you must provide, with
  4210.     bltxpt, the rectangle position for each bitplane. The modulo is
  4211.     read last and added to the written word to locate the start of the
  4212.     next row.
  4213.  
  4214.     Commodore has provided some bery powerful instructions that 
  4215.     fully use the blitter (BltBitMap(), BltTemplate(), ScrollRaster())
  4216.  
  4217.     As with drawing lines, the modulo registers also have a specific
  4218.     purpose. However, as we said earlier, the Draw() function does all
  4219.     the work for you.
  4220.  
  4221.     ------------------------------------------------------------------
  4222.  
  4223. bltafwm        $044 Blitter    First word mask for Source A
  4224. bltalwm        $046 Blitter    Last word mask for Source A
  4225.  
  4226.     In order to blit a rectangle that starts in the middle of a word 
  4227.     instead of at a word address, the first and last word of a row to
  4228.     be blitted (the source A) is ANDed with a specific value. The
  4229.     remaining bits are changed, reworked and written into the row.
  4230.  
  4231.     -----------------------------------------------------------------
  4232.  
  4233. bltXdat        $074    Blitter X data register.
  4234.  
  4235.     Similar to sound generation, the individual words from source a,b 
  4236.     and c are read here before they are logically merged. This action
  4237.     is performed by the DMA channel. After the blit of these three 
  4238.     words, the resulting word is written, by the DMA channel to the 
  4239.     bltdat and then to the target. The entire blit operation is 
  4240.     reduced to operating on three words.
  4241.  
  4242.                 PAGE 561
  4243.  
  4244. -----------------------------------------------------------------------------
  4245.  
  4246. bltcon0        $040    Blitter control register 0
  4247. bltcon1        $042    Blitter control register 1
  4248.  
  4249. These two registers are used to control the Blitter operation (blits).
  4250. There are two modes, Area and Line, that are selected through bit 0 
  4251. of BLTCON1:
  4252.  
  4253.  
  4254. The Area Mode    bltcon0
  4255.  
  4256.     Bits 15-12    ASH3-0:
  4257.     If you have ever moved a bob by pixels, you probably wondered 
  4258.     how this was possible since the blitter can only access word
  4259.     addresses.
  4260.  
  4261.     By using the bits ASH3-0, you can select how many pixels the data 
  4262.     from source A is rotated before being written to the target.
  4263.  
  4264.     Bits 11-8     USEx:
  4265.     These bits determine which source the blitter can access. If you
  4266.     have only two sources, it would be a waste of time to access all 
  4267.     three possible sources. Besides, there wouldnt be any data in 
  4268.     source C.
  4269.  
  4270.     With the USEx bits you can select your source; X stands for the 
  4271.     a,b,c and d. Make sure you activate the target, otherwise the 
  4272.     data will have no place to go.
  4273.  
  4274.     Bits 7-0 LF7-0:
  4275.     These bits determine the type of logic operation that will be 
  4276.     performed, by the blitter, on your source data. The bit patterns
  4277.     written here are also called minterms, which you learned about in 
  4278.     connection with the Blitter instructions. Only two sources are
  4279.     considered, b and c.
  4280.  
  4281.     However, there are three sources you can use. What happens with 
  4282.     each source is determined by the individual bits LF7-0.
  4283.     
  4284.                 PAGE 562
  4285.  
  4286. -----------------------------------------------------------------------------
  4287.  
  4288.     Bits:LF       7     6      5      4      3      2      1      0
  4289.                              _     _      __    _      _ _    __     ___ 
  4290.         Minterm:     ABC   ABC    ABC    ABC    ABC    ABC    ABC    ABC
  4291.  
  4292.         ABC:D = A and B and C
  4293.           _
  4294.         ABC:D = A and B and !C
  4295.          _
  4296.         ABC:D = A and !B and C
  4297.          __
  4298.         ABC:D = A and !B and !C
  4299.         _
  4300.         ABC:D = !A and B and C
  4301.      .
  4302.      .
  4303.      .
  4304.  
  4305. The area mode  bltcon1 has the following bit pattern in area mode:
  4306.  
  4307.     Bits 15-12     BSH3-0:
  4308.     These bits have the same meaning as ASH3-0 with bltcon0, except 
  4309.     that source B is shifted.
  4310.  
  4311.     Bits 11-5: Commodore has not assigned a function to these bits yet. 
  4312.     Bits 4, 3    EFE/IFE:
  4313.     Earlier we mentioned that the blitter is capable of performing our
  4314.     fills. Thses two bits determine the fill mode for an area already
  4315.     set for the Blitter. When bit EFE is set (Exclusive Fill Enable),
  4316.     the area outline to the left of the filled area is erased after 
  4317.     the fill operation. If EFE is unset and IFE is set (Inclusive
  4318.     Fill Enable), the area is filled normally. To achieve a clean 
  4319.     fill, the area border must fulfill specific requirements: Only
  4320.     one single pixel may be set on each horizontal line (see SING).
  4321.     
  4322.     Bit 2 FCI:
  4323.     This bit is the starting value for the fill "flip-flop". Just
  4324.     like an electronic flip flop, the Blitter also switches status 
  4325.     back and forth while filling. Whenever a specific external event
  4326.     occurs, the Blitter switches and then keeps this status until a 
  4327.     new event of the same type happens.
  4328.  
  4329.     An event for the Blitter looks like this: the Blitter finds a set
  4330.     bit in a bitplane row and the status of the Fill Flip Flop is
  4331.     toggled. All the following bits that are clear are written with the
  4332.     value of FCI. You can also determine whether an area is filled
  4333.     inside or outside.
  4334.     
  4335.     Bit 1 DESC:
  4336.     This bit determines the direction in which the Blitter works in the 
  4337.     specified data area (source a,b,c and d). When DESC is set, the
  4338.     direction is downward from the provided address. When DESC is clear,
  4339.     the Blitter works upwards. This bit is very important when target
  4340.     and source overlap.
  4341.  
  4342.                 PAGE 563
  4343.  
  4344. -----------------------------------------------------------------------------
  4345.  
  4346.     Bit 0 LINE:
  4347.     (=0) When this bit is clear the Blitter operates in Area mode.
  4348.  
  4349.     When drawing lines all of these bits have new meanings:
  4350.  
  4351. BLTCON0
  4352. --------
  4353.  
  4354.     Bits 15-12 START3-0:
  4355.     These bits set the code for the horizontal position of the first
  4356.     pixel of the line.
  4357.     
  4358.     The exact format used by Commodore for START3-0 was not available 
  4359.     when this book was written. For this reason we have provided only 
  4360.     limited information on drawing lines with the blitter.
  4361.  
  4362.     Bits 11, 10, 9, 8 %1011:
  4363.     These bits must be initialised to a value of %1011 (only Commodore
  4364.     knows why).
  4365.  
  4366.    Bits 7-0 LF7-0:
  4367.     When drawing patterned lines, the Blitter sources are used in some
  4368.     capacity. Again, only Commodore has the complete information. 
  4369.  
  4370.  
  4371. BLTCON1
  4372. -------
  4373.     Bits 15-12 TEXTURE3-0:
  4374.     A value (0-15) in these four bits sets the starting bit position
  4375.     for the pattern in a line.
  4376.  
  4377.     Bits 11-7 %00000
  4378.         All these bits be must be cleared.
  4379.  
  4380.     Bit 6 SIGN:
  4381.     This bit must contain the sign for the rise of the line.
  4382.     
  4383.     Bit 5 %0
  4384.     This bit is reserved for a new mode and should be kept clear for
  4385.     upward compatibility with other programs and machines like the
  4386.     2000.
  4387.     
  4388.     Bits 4-2 SUD, SUL, AUL:
  4389.     These bits are used for super fast line drawing. This super fast
  4390.     method is based on the symmetric characters of a line that the
  4391.     blitter uses. You control the drawing of a line with these three
  4392.     bits named "sometimes up or down", "sometimes up or left" and 
  4393.     "always up or left". Whether they can be set by you or only by the
  4394.     blitter is somethinf we were unable to find out.
  4395.  
  4396.                 PAGE 564
  4397.  
  4398. -----------------------------------------------------------------------------
  4399.  
  4400.     Bit 1  SING:
  4401.     If this bit is set, each line is displayed by only one pixel in 
  4402.     each bitplane row. This is important for the blitter when filling
  4403.     areas.
  4404.  
  4405.     Bit 0  LINE:
  4406.     (=1) This bit determines the blitter mode. When set the blitter 
  4407.     operates in line mode.
  4408.  
  4409.     ----------------------------------------------------------------
  4410.  
  4411.  
  4412.  
  4413. bltsize    $058    Blitter: start and size (width, height)
  4414.  
  4415. This register contains the height and width of the Blitter's operating area. 
  4416. All operations occur in this defined window. The starting address is set in 
  4417. bltXpt and the operations are determined by bltcon0/1 and other registers.
  4418.  
  4419. When you access these registers (through the Copper or 68000), Whether 
  4420. reading or writing, the Blitter immediately executes the blit.
  4421.  
  4422. This is why you should first initialise all other registers (BLTAF/:WM,
  4423. BLTxDAT,BLTCON0/1, BLTxMOD etc..) and then perform the write. This start 
  4424. effect also applies to drawing lines.
  4425.  
  4426.  
  4427. Bits 15-6     H9 - H0
  4428.     These ten bits determine the number of rows for the Blitter's
  4429.     operating area and can contain a value between 0 and 1024.
  4430.  
  4431. Bits 5-0     W5-WO:
  4432.     These bits determine the width, in words (64 * 16 bits = 1024), of 
  4433.     the Blitter's operation area. Theoretically the Blitter can operate 
  4434.     with a memory area of 1024 x 1024 pixels (a superbitmap).
  4435.  
  4436.     This register also has a different effect when it used for line 
  4437.     drawing. BLTSIZE controls the Iine length and accessing this 
  4438.     register tells the Blitter to start drawing the line. The H9-H0 
  4439.     bits control the line length (up to 1024 pixels) and bits W5-W0 
  4440.     must be initialised to %00010.
  4441.  
  4442.     Since we could not provide complete information about the Blitter 
  4443.     registers, we recommend that you utilise the libraries and BASIC 
  4444.     instructions.
  4445.  
  4446.         --------------------------------------------
  4447.  
  4448. bplpt[6]    $0E0    Bit-plane X pointer
  4449.  
  4450.     This register pair (see ac_ptr) contains the 18 bit pointer to the 
  4451.     starting address for bit-plane x (x=1,2,3,4,5,6) DMA data. This 
  4452.     register, which must be initialised by the 68000 or the Copper 
  4453.     after every raster return, is responsible for making your graphics 
  4454.     visible.
  4455.  
  4456.                 PAGE 565
  4457.  
  4458. -----------------------------------------------------------------------------
  4459.  
  4460.     Since there are a few more than the 480 visible rows on your screen (
  4461.     with interlace and overscan), a scrolling effect can be achieved 
  4462.     through this register. However, instead of manipulating the hardware 
  4463.     yourself, you can use the RxOffset and RyOffset variables in the 
  4464.     RasInfo structure and the library instruction scrollVPort() to 
  4465.     scroll an entire bit-map in a ViewPort.
  4466.  
  4467.         --------------------------------------------
  4468.  
  4469. bpldat[6]    $110    Bit-plane X data
  4470.  
  4471.     As with DMA operations, registers are also required for temporary 
  4472.     data storage. After the DMA controller stores data in these six 
  4473.     registers, they are used by the video hardware (Videoshifter).
  4474.  
  4475.         --------------------------------------------
  4476.  
  4477. bpl1mod        $108    Bit-plane modulo (odd planes)
  4478. bpl2mod        $10A    Bit-plane modulo (even planes)
  4479.  
  4480.     These registers contain the modulo (the width) for the even (2,4,6) 
  4481.     and odd (1,3,5) bit-planes (seeDBBLPF and bplXmod). The modulos are 
  4482.     essential for a correct display.
  4483.  
  4484.         --------------------------------------------
  4485.  
  4486. bplcon0        $100    Bit-plane control register
  4487. bplconl        $102    Bit-plane control register
  4488. bplcon2        $1-4    Bit-plane control register
  4489.  
  4490.     You can control the video shifter like the Blitter. Use these three 
  4491.     registers, which are the core of the entire graphic display.
  4492.  
  4493.  
  4494. bplcon0
  4495. -------
  4496.  
  4497. Bit 15 HIRES: 
  4498.     If this bit is set, the display is in high resolution mode (640 *
  4499.      ... pixels). In this mode (4 bit-planes), you can only use 16 colors, 
  4500.     which are determined by the lower 15 color registers (see COLORxx).
  4501.  
  4502. Bits 14-12 BPU2-0: 
  4503.     These bits determine how many bit-planes you are using (0-6). Six
  4504.     bit-planes are only required for dual playfields (DBLPF), 
  4505.     hold-and-modify (HAM), and extra halfbrite modes. The number of 
  4506.     bit-planes determines the number of possible colors: colors = 2BPU. 
  4507.     So, it is possible to use five bit-planes and 32 colors without 
  4508.     hold-and-modify. Setting all of these bits to zero displays only 
  4509.     the background color (COLOR00).
  4510.  
  4511. Bit 11 HAM:
  4512.     This bit switches on the hold-and-modify mode.
  4513.  
  4514. Bit 10 DBLPF:    
  4515.     This bit switches on the dual playficld mode.    
  4516.     
  4517.                 PAGE 566
  4518.  
  4519. -----------------------------------------------------------------------------
  4520.     
  4521. Bit 9 COLOR:
  4522.     Setting this bit sets your display output for a composite monitor. 
  4523.     This means that the normal three color (RGB) is no longer used, and 
  4524.     a single output for composite is activated.
  4525.  
  4526.     All older model monitors are of the composite type. Since the colors 
  4527.     must be separated from the single input signal, the picture on a 
  4528.     composite isn't as good as one that uses RGB.
  4529.  
  4530. Bit 8 GENLOCK:
  4531.     With a genlock interface it is possible to display, instead of the 
  4532.     background color, the output from a video recorder, videocamera or 
  4533.     laser disk. This enables you to overlay the background video with 
  4534.     your own title and graphics. In order to use such an interface, your 
  4535.     software has to set this bit.
  4536.  
  4537. Bit 7 EXTRA_HALFBRITE:
  4538.     This bit switches on the halfbrite mode.
  4539.  
  4540. Bits 6-4: Not used
  4541.  
  4542. Bit 3 LPEN:
  4543.     In order to use a light pen, this bit must be set. This tells the 
  4544.     Amiga to test for the light pen position through the control port. 
  4545.     Light pens can only be used with control port one (see VPOSR).
  4546.  
  4547. Bit 2 LACE:
  4548.     This bit switches on the interlaced mode, which doubles the vertical 
  4549.     display resolution from 200 rows to 400 rows. With interlace the 
  4550.     screen is actually displayed twice. The first display is the even 
  4551.     numbered rows and the second display is the odd numbered rows of 
  4552.     the bit-map.
  4553.  
  4554. Bit 1 ERSY:
  4555.     This bit enables external synchronization of the electronic scanning 
  4556.     beam.
  4557.  
  4558. Bit 0:    Not used
  4559.  
  4560. bplcon1
  4561. -------
  4562.  
  4563. Bits 15-8: Not used
  4564.  
  4565. Bits 7-4 PF2H3-0,
  4566. Bits 3-0 PFlH3-0:
  4567.     These bits set the number of pixels that a playfield is horizontally 
  4568.     scrolled when displayed. You can use any value between zero and 15 
  4569.     pixels.
  4570.  
  4571.                 PAGE 567
  4572.  
  4573. -----------------------------------------------------------------------------
  4574.  
  4575.     By using bplpt[x], you can achieve word type scrolling. These bits 
  4576.     are also available for finer scrolling.
  4577.  
  4578.     However, you can also use ScrollVPort() and RasInfo.RxOffset. So this 
  4579.     register is not too important.
  4580.  
  4581. bplcon2
  4582. -------
  4583.  
  4584. Bits 15-7:    Not used
  4585.  
  4586. Bit 6 PFsPRI:
  4587.     Setting this bit gives playfield 2 complete video priority over 
  4588.     playfield 1. Clearing this bit puts playfield 1 in the foreground 
  4589.     (PFBA).
  4590.  
  4591. Bit 503 PF2P2-0,
  4592. Bits 2-0 PF1P2-0:
  4593.     The bit combination in these bits set the video priorities between 
  4594.     playfield 1 and the sprites and between playfield 2 and the sprites:
  4595.  
  4596.     Value         Priority
  4597.  
  4598.     000        PF1/2 > SP0/1 > SP2/3 > SP4/5 > SP6/7
  4599.     001        SP0/1 > PF1/2 > SP2/3 > SP4/5 > SP6/7
  4600.     010        SP0/1 > SP2/3 > PF1/2 > SP4/5 > SP6/7
  4601.     011        SP0/1 > SP2/3 > SP4/5 > PF1/2 > SP6/7
  4602.     100        SP0/1 > SP2/3 > SP4/5 > SP6/7 > PF1/2
  4603.  
  4604.     ('>' means has Priority over)
  4605.  
  4606.     You don't have to set the video priority for sprites because the 
  4607.     hardware automatically knows that the lower numbered sprites have 
  4608.     priority over the higher numbered sprites. The mouse pointer has 
  4609.     sprite number zero with priority over all the other sprites.
  4610.  
  4611.     When different ViewPorts are displayed, These registers are usually 
  4612.     changed many times for each display. If there is only one ViewPort, 
  4613.     the Copper changes these every sixtieth of a second.
  4614.  
  4615.         --------------------------------------------
  4616.  
  4617. clxcon    $098    Collision control
  4618.  
  4619.     This register determines what type of collisions (between 
  4620.     bit-planes, sprites and bit-planes, or sprites and sprites) are 
  4621.     looked for by your Amiga. Through the value stored in clxdat, you 
  4622.     can discover which objects have collided. The individual bits for 
  4623.     clxcon have the following functions:
  4624.  
  4625. Bits 15-12 ENSP7, 5, 3, 1:
  4626.     Setting one of these bits allows you to check the odd numbered 
  4627.     sprites    (7, 5, 3, 1) for collision control. The even numbered 
  4628.     sprits (0, 2, 4, 6) are always checked for collisions, but the odd 
  4629.     ones aren't
  4630.  
  4631.                 PAGE 568
  4632.  
  4633. -----------------------------------------------------------------------------
  4634.  
  4635. However, unless you are using attached sprites that are at the same position, 
  4636. you cannot determine through CLxDAT whether an odd or even numbered sprite 
  4637. has collided with an object.
  4638.  
  4639. Bits 11-6 ENBPx:
  4640.     Use these bits to set which bit-planes (x = 6-1) are tested for 
  4641.     collisions. Clearing these bits always indicates one bit-plane 
  4642.     collision.
  4643.  
  4644. Bits 5-0 MVBP6-1:
  4645.     These bits determine whether bit-plane collisions with sprites are 
  4646.     registered by set or cleared bits. For example, only one bit-plane 
  4647.     collision is registered when a pixel is set in bit-plane 1 and 
  4648.     not registered for bit-plane 2 at the same position, etc. This 
  4649.     makes it possible to determine if a sprite has collided with a 
  4650.     specific colored pixel.
  4651.  
  4652.         --------------------------------------------
  4653.  
  4654. clxdat    $00E    Collision data register
  4655.  
  4656. This register helps you to determine which collisions have occurred.
  4657.  
  4658.     Bit 15    unused (usually = 1)
  4659.     Bit 14    Sprite 4 (or 5) with sprite 6 (or 7)
  4660.     Bit 13    Sprite 2 (or 3) with sprite 6 (or 7)
  4661.     Bit 12    Sprite 2 (or 3) with sprite 4 (or 5)
  4662.     Bit 11    Sprite 0 (or 1) with sprite 6 (or 7)
  4663.     Bit 10    Sprite 0 (or 5) with sprite 4 (or 5)
  4664.     Bit  9    Sprite 0 (or 1) with sprite 2 (or 3)
  4665.     Bit  8    Playfield 2 with sprite 6 (or 7)
  4666.     Bit  7    Playfield 2 with sprite 4 (or 5)
  4667.     Bit  6    Playfield 2 with sprite 2 (or 3)
  4668.     Bit  5    Playfield 2 with sprite 0 (or 1)
  4669.     Bit  4    Playfield 1 with sprite 6 (or 7)
  4670.     Bit  3    Playfield 1 with sprite 4 (or 5)
  4671.     Bit  2    Playfield 1 with sprite 2 (or 3)
  4672.     Bit  1    Playfield 1 with sprite 0 (or 1)
  4673.     Bit  0    Playfield 1 with playfield 2
  4674.  
  4675.     PIayfield 1 is the odd bit-planes (1, 3, 5) and playfield 2 the 
  4676.     even (2, 4, 6).
  4677.  
  4678.     This register provides many possibilities for determining sprite 
  4679.     collisions. Since bit-plane collisions provide less information, 
  4680.     specific determinations are impossible.
  4681.  
  4682.     Remember that sprite collisions are first registered when two pixels 
  4683.     overlap instead of when the edges collide.
  4684.  
  4685.                 PAGE 569
  4686.  
  4687. -----------------------------------------------------------------------------
  4688.  
  4689. Also, when you read this register, it is immediately cleared and not written 
  4690. to again until the next raster scan (vertical blank).
  4691.  
  4692.         --------------------------------------------
  4693.  
  4694. color[32]     $180    Color register
  4695.  
  4696. There are 32 color registers ($180 - $1BE) that contain a 12 bit color code 
  4697. for every color that exist in the bit-planes..
  4698.  
  4699. The color register that determines the color information for a specific pixel 
  4700. is calculated by ORing - the value for all bit-planes for that pixel
  4701. position.
  4702.  
  4703. The color code is composed of 12 bits which makes 4096 different colors 
  4704. possible. You can use a maximum of 32 of the 4096 colors for one screen 
  4705. (hold-and-modify is an exception to this rule). Your pixel is then displayed 
  4706. in the color calculated for its color register. Here is the bit pattern 
  4707. used in all of the color registers:
  4708.  
  4709.     Bits 15-12        Unused
  4710.     Bits 14-8 Red 3-0    Red component of color
  4711.     Bits 7-4 Green 3-0    Green component of color
  4712.     Bits 3-0 Blue3-0        Blue component of color
  4713.  
  4714. The fourth bit determines the intensity of a color component (red, green, 
  4715. blue). It is possible to create almost any color by mixing the three
  4716. different colors and their intensities (0 = dark, $0f = light).
  4717.  
  4718.         --------------------------------------------
  4719.  
  4720. copcon    $02E    Copper control register
  4721.  
  4722. This register is a one bit register. Only bit one is used, all the other 
  4723. bits are unused.
  4724.  
  4725. Some computer users refer to this register as the Copper danger bit. 
  4726. Register zero (bltddat) to register 30 (strlong) are exempt from Copper 
  4727. manipulation.
  4728.  
  4729. Usually, the Copper cannot access registers 31 (bltcon0) to 49 (dsksync). 
  4730. Setting the danger bit allows you to use these registers. Any reset clears 
  4731. this bit.
  4732.  
  4733.         --------------------------------------------
  4734.  
  4735. copjump1 $088 (Strobe) Copper Newstart the first list.
  4736. copjump2 $08A (Strobe) Copper Newstart the second list.
  4737.  
  4738. By accessing these registers, either through the Copper or 68000, causes the 
  4739. Copper to execute a Copper list. The starting list address should be in 
  4740. cop1lc or cop2lc and the Copper-Program-Counter (PC) is directed to this 
  4741. address.
  4742.  
  4743.                 PAGE 570
  4744.  
  4745. -----------------------------------------------------------------------------
  4746.  
  4747. The Copper list, whose start address is in cop1lc, is executed with each 
  4748. raster scan (vertical blank).
  4749.  
  4750. For your own experiment with Copper list it is safer to use the user Copper 
  4751. list. The entire display is controlled by the Copper and direct access can 
  4752. cause serious problems unless you take control of the entire display.
  4753.  
  4754.         --------------------------------------------
  4755.  
  4756. cop1lc    $080/$082 Address of first Copper list.
  4757. cop2lc    $080/$084 Address of second Copper list.
  4758.  
  4759. When you access registers copjmp1 or copjmp2, they contain the starting 
  4760. addresses of Copper lists for execution.
  4761.  
  4762. The address of the hardware Copper list is loaded into these registers 
  4763. through Loadview().Cop2lc is only used with interlace mode for the second 
  4764. screen scan. After the first scan the second Copper list is started by the 
  4765. first.
  4766.  
  4767.         --------------------------------------------
  4768.  
  4769. copins    $08C    Copper instruction register
  4770.  
  4771. Like the DMA channcl, the Copper also uses a temporary buffer. Two 16 bit 
  4772. instruction words are stored in this register and executed sequentially.
  4773.  
  4774. The  first instruction word consists of one of the three possible Copper 
  4775. instructions, the affccted hardware register and the position of the 
  4776. electronic beam that will be waited for.
  4777.  
  4778. However, the three possible instructions, CMOVE(), CWAIT() and CEND() aren't 
  4779. the only instructions you can use. The instructions Move, Wait and Skip are 
  4780. also available.
  4781.  
  4782. The reason for this is that the CEND() instruction is actually a 
  4783. subinstruction of CWAIT() and the Skip instruction wasn't considered useful 
  4784. enough to be includcd in C.
  4785.  
  4786. MOVE and WIAT have the same meaning as CMOVE () and CWAIT ().
  4787.  
  4788. The skip instruction actually skips the following Copper instructions when 
  4789. the electronic beam has reachcd the selected position.
  4790.  
  4791. A complete Copper instruction consists of two 16 bit words that are 
  4792. loaded and executed sequentially in these registers.
  4793.  
  4794. Instruction: MOVE
  4795.  
  4796. 1. Instruction Word
  4797.  
  4798.                 PAGE 571
  4799.  
  4800. -----------------------------------------------------------------------------
  4801.  
  4802. Bits 15-9 Unused
  4803.  
  4804. Bits 8-1 DA8-1:
  4805.     DAx (Destination Address), which is used by the Move instruction, 
  4806.     selects the register the value of the second instruction will be 
  4807.     written. DA is specified as an offset from $DFF000 for the selected 
  4808.     hardware register.
  4809.  
  4810. Bit 0 0: This bit is used to identify a Copper move instruction. Move must 
  4811.     always be zero (The first bit of the second instruction word isn't 
  4812.     required for decoding this instruction).
  4813.  
  4814. 2. Instruction Word
  4815.  
  4816. This word contains the 16 bit value that will be written to the register 
  4817. seleclted by DA.
  4818.  
  4819. WAIT
  4820. ----
  4821.  
  4822. 1. Instruction Word
  4823.  
  4824. Bits 15-9 VP7-VP0:
  4825.     VP (Vertical Position) contains the vertical (Y) position of the 
  4826.     electronic beam that will be waited for.
  4827.  
  4828.     There are 262 different vertical beam positions that can be waited 
  4829.     for. Since VP has a data width of only eight bits, a small trick must 
  4830.     be used in order to access positions 256 through 262.
  4831.  
  4832.     Usually, first you wait for the vertical position 255. Then you use a 
  4833.     second wait instruction for a position between zero and six.
  4834.  
  4835. Bits 8-1 HP8-HP1:
  4836.     HP (horizontal position) contains the horizontal (X) position for the 
  4837.     electronic beam that will be waited for. It can contain a position 
  4838.     value betweenn zero and 226. Since the available data width is only 
  4839.     seven bits, the Copper can access only 113 positions. This limits 
  4840.     you to a pixel resolution of four with low-res (HIRES = 0) or eight 
  4841.     with hi-res (HIRES = 1).
  4842.  
  4843.     It is possible for you to wait for every fourth pixel position. 
  4844.     However, this doesn't mean that you can change a register for every 
  4845.     four pixels. When you execute two moves, one after the other, there 
  4846.     is a gap of eight low-res pixels (with hi-res this value doubles).
  4847.  
  4848. Bit 0 1:
  4849.     This bit and bit zero of the second instruction word are used to 
  4850.     identify the Copper instructions wait and Skip. When bit zero of the 
  4851.     first
  4852.  
  4853.                 PAGE 572
  4854.  
  4855. -----------------------------------------------------------------------------
  4856.  
  4857.     word is clear, the Copper knows that it is working with a MOVE 
  4858.     instruction so it doesn't test the second instruction word.
  4859.  
  4860.     When bit zero of the first word is set the Copper knows that it must 
  4861.     either wait or skip. Which action is performed is set by you in the 
  4862.     instruction word.
  4863.  
  4864.     2. Instruction Word
  4865.  
  4866. Bit 15 BFD:
  4867.     Setting this bit puts the wait instruction on hold until the Blitter 
  4868.     says "OK" (Blitter Finished Disable).
  4869.  
  4870. Bits 14-8 VE6-VEO:
  4871.     VE (Vertical Comparison Enable) and HP (Horizontal Comparison Enable) 
  4872.     determine which bits are used for comparing the electronic beam 
  4873.     position.
  4874.  
  4875. Bits 7-1 HE-8-HE-2:
  4876.     This bit has the same meaning for horizontal position as VE does for 
  4877.     vertical positioning.
  4878.  
  4879. Bit 0 %0: 
  4880.     The Copper recognises the WIAT instruction at this location.
  4881.  
  4882.     SKIP
  4883.  
  4884.     Except for the set or unset status of bit zero of the second 
  4885.     instruction word, the bit pattern of the instruction words for SKIP 
  4886.     and WAIT are very similar. The meaning of all the other bits is the 
  4887.     same.
  4888.  
  4889.  
  4890.         --------------------------------------------
  4891.  
  4892. diwstrt    $08E    Display window start (top, left position)
  4893. diwstop    $090    Display window stop (lower, right position)
  4894.  
  4895.     Use these registers to set the actual display (ViewPort) size for 
  4896.     your screen. The values in these registers determine the upper left 
  4897.     corner and the lower right corner of the screen. Besides the 
  4898.     background color (in color[0]), nothing can be displayed outside 
  4899.     this screen.
  4900.  
  4901.     These positions are specified in normal (not interlaced) raster row 
  4902.     and low resolution pixel values. You don't have to change these 
  4903.     values to use interlace or hi-res modes.
  4904.  
  4905.     The bit pattern of these registers is as follows:
  4906.  
  4907. diwstrt
  4908.  
  4909.     Bit        Function
  4910.     ---------    ------------------------------------------------
  4911.     15-8        VSTART    vertical start position
  4912.     7-0        HSTART    horizontal start position
  4913.  
  4914.                 PAGE 573
  4915.  
  4916. -----------------------------------------------------------------------------
  4917.  
  4918.     The starting position of your display is set in these two registers. 
  4919.     However, you cannot set the starting position of a ViewPort here.
  4920.  
  4921.     Because of the eight bit data width of these registers, you can only 
  4922.     use horizontal and vertical starting and ending positions between 
  4923.     zero and 256 raster rows.
  4924.  
  4925. diwstop
  4926.  
  4927.     Bit        Function
  4928.     15-8        VSTOP    vertical start position
  4929.     7-0        HSTOP    horizontal start position
  4930.  
  4931.     Diwstop also has the same eight bit pattern. In order to display a 
  4932.     window wider than 256 pixels, a value of $100 must be added to the 
  4933.     X end coordinate to maintain the actual end position.
  4934.  
  4935.     Bit VSTOP7 is very important for calculating the actual vertical end 
  4936.     coordinate. The nonexistent VSTOP8 bit is actually the compliment 
  4937.     of VSTOP7. If VSTOP7 is cleared, VSTOP8 is set. When VSTOP7 is zero, 
  4938.     you simply add 256 to calculate the actual vertical end position.
  4939.  
  4940.     lf VSTOP7 is set you can disregard VSTOP8 since it is zero and not 
  4941.     active in the calculation.
  4942.  
  4943.     When writing to these registers, be aware of "Vertical Blank". The 
  4944.     top visible raster is not raster zero just as the first visible 
  4945.     column is not the first column raster wise.
  4946.  
  4947.     The electronic beam needs some time to recover after reaching the 
  4948.     bottom screen border. This is similar to when the beam finishes 
  4949.     displaying a raster row.
  4950.  
  4951.     Normal values for diwstrt and diwstop are:
  4952.  
  4953.         diwstrt=$2c81
  4954.         diwstop=$f4c1
  4955.  
  4956.     This provides a screen window size of:
  4957.  
  4958.         HSTOP+$100-HSTART = $c1-t$100-$81 = $140 = 320 Pixels 
  4959.         VSTOP+(VSTOP8 * $100)-VSTART = $F4( = %11110100)+(0*
  4960.         $100) - $2c = 200 Normal-Raster rows
  4961.  
  4962.     Also remember not to use a vertical starting value smaller than $20     
  4963.     Because, while creating the screen, the vertical blank needs an area 
  4964.     for the beam return. Otherwise you wouldn't see anything on the 
  4965.     screen. Because the electronic beam wasn't given enough recovery 
  4966.     time.
  4967.  
  4968.                 PAGE 574
  4969.  
  4970. -----------------------------------------------------------------------------
  4971.  
  4972. ddfstrt    $092    Screen data fetch start
  4973. ddfstop    $094    Screen data fetch stop
  4974.  
  4975.     These two registers determine when to get the data from memory and 
  4976.     display it.
  4977.  
  4978.     One timing cycle is used to display two pixels. To determine when to 
  4979.     start and stop displaying data, use the values from the diwstrt and 
  4980.     diwstop registers. Eventually you will add a small offset to these 
  4981.     values and then the desired values for ddfstrt and ddfstop will be 
  4982.     available.
  4983.  
  4984.     The offset is different for lo-res and hi-res modes. For lo-res the 
  4985.     offset is 8.5, and for hiRES is 4.5.
  4986.  
  4987.     Start position values are:
  4988.  
  4989.         ddfstrt=($81/2-8.5)=$38
  4990.         (Hi-res: ddfstrt = ($81/2 - 4.5) = $3C)
  4991.  
  4992.     You calculate the value for ddfstop like this:
  4993.  
  4994.         ddfstop = ddfstrt + (16/2 *(Number of words per line -1))
  4995.             (low-resolution)
  4996.         ddfstop = ddfstrt + (16/4 *(Number of words per line -2))
  4997.             (high-resolution)
  4998.  
  4999.     Again the number of displayed pixels (1 word = 16 pixels) is halved 
  5000.     and quartered. The quartered value for hi-res is natural because 
  5001.     hi-res displays twice as many pixels in the same amount of time.
  5002.  
  5003.     You cannot select these values because they are limited from the 
  5004.     hardware side. DDFSTRT cannot be smaller than $18 and DDFSTOP cannot 
  5005.     be larger than $D8. These values permit a display of 376 pixels with 
  5006.     lo-res (752 with hi-res). By using a DDFSTRT value smaller than $38, 
  5007.     you can prevent the display of several sprites.
  5008.  
  5009.  
  5010.         --------------------------------------------
  5011.  
  5012. dmacon    $096    DMA control register (write)
  5013. dmaconr    $002    DMA control register (read)
  5014.  
  5015.     These registers are used by the DMA controller to manage the 
  5016.     information fed to it by the various processors.
  5017.  
  5018.     With dmacon, set which DMA channel is open.
  5019.  
  5020.     This is the bit pattern which is the same for both registers:
  5021.  
  5022. Bit 15 SET/CLR:
  5023.     (see ADKCON)
  5024.  
  5025.                 PAGE 575
  5026.  
  5027. -----------------------------------------------------------------------------
  5028.  
  5029. Bit 14    BUSY:
  5030.     This bit shows the blitter status. When the blitter is working this
  5031.     bit is set.
  5032.  
  5033. Bit 13  BZERO:
  5034.     This bit is set when all the result bits of a blit (screen area
  5035.     copy etc...) were zero.
  5036.  
  5037. Bits 12,11:  Unused.
  5038.  
  5039. Bit 10    BLTPR1:
  5040.     This bit determines the priority between the Blitter and the 68000.
  5041.     How the 14mhz clock frequency is divided between the two processors
  5042.     is set here.
  5043.  
  5044. Bit 9   DMAEN:
  5045.     When this bit is set, it is possible to activate all the DMA 
  5046.     channels. If this bit is clear the value of all the following
  5047.     bits have no effect on the status of the DMA channels that they
  5048.     activate. So, DMAEN is the controller of DMA activity.
  5049.  
  5050. Bit 8   BPLEN:
  5051.     When this bit and DMAEN are set, the DMA channel for screen data
  5052.     transfer from the bitplanes is activated.
  5053.  
  5054. Bit 7   COPEN:
  5055.     This bit sets the Copper status. If it is set, the Copper can work
  5056.     and if it is clear, the Copper is shut off.
  5057.  
  5058. Bit 6   BLTEN:
  5059.     What applies to the Copper with COPEM applies here to the Blitter.
  5060.  
  5061. Bit 5   SPREN:    
  5062.     Setting this bit enables transfer of sprite data through the DMA
  5063.     channels.
  5064.  
  5065. Bit 4   DSKEN:
  5066.     This bit determines the status of the disk DMA channel. Clearing 
  5067.     this bit stops all data transfers between computer and floppy.
  5068.  
  5069. Bits 3-0 AUD3-0EN:
  5070.     These bits determine the status for the sound DMA channels. 
  5071.     Clearing these bits prevents any sound activation through the DMA
  5072.     channels.
  5073.  
  5074.                 PAGE 576
  5075.  
  5076. -----------------------------------------------------------------------------
  5077.     
  5078. dskpt    $020    Disk pointer
  5079.  
  5080.     This register pair (also an 18 bit pointer) determines the data read 
  5081.     storage address for the disk DMA data that will will be written to 
  5082.     disk.
  5083.  
  5084.         --------------------------------------------
  5085.  
  5086. dsklen    $024    Disk data length
  5087.  
  5088.     Thiss register contains the word count of the words to be sent or 
  5089.     received through the disk DMA channel. One bit of this register 
  5090.     determines the data direction (RAM -> disk or disk -> RAM). Another 
  5091.     bit determines whether access to the DMA channel is possible.
  5092.  
  5093.     Accessing this register executes the data transfer. The register must 
  5094.     be written to twice with the same data. When all data has been 
  5095.     transferred a "Disk Block Interrupt" (see INTREQ) is sent that stops 
  5096.     the data transfer.
  5097.  
  5098.     Just setting the DMA register isn't the only requirement for 
  5099.     executing a complete disk operation such as loading a program. 
  5100.     You must also set a pair of I/O registers for the CIAs. However, we 
  5101.     won't discuss these registers Because they belong in a different book, 
  5102.     such as "Amiga System Programmers Guide".
  5103.  
  5104. Bit 15 DMAEN:
  5105.     Setting this bit enables the data transfer through the DMA channel.
  5106.  
  5107. Bit 14 WRITE:
  5108.     This bit determines the write/read direction. When set, the data is 
  5109.     read from RAM through the DAM channel and written to disk. When 
  5110.     clear, the data is read from disk.
  5111.  
  5112. Bits 13-0 LENGTH:
  5113.     These bits contain the number of words that will be read or written.
  5114.  
  5115.         --------------------------------------------
  5116.  
  5117. dskdat    $026    Disk DMA data (write)
  5118. dskdatr    $008    Disk DMA data (read)
  5119.  
  5120.     These registers contain the data that is either read or written 
  5121.     through the disk DMA channel.
  5122.  
  5123.     You should remember that the dskdatr register is protected from 
  5124.     Copper access.
  5125.  
  5126.         --------------------------------------------
  5127.  
  5128. dskbytr    $01A    Disk databyte and status
  5129.  
  5130.     This register is a data buffer that is directly linked to The disk 
  5131.     microprocessor. From this register, data is sent to the DMA 
  5132.     controller
  5133.  
  5134.                 PAGE 577
  5135.  
  5136. -----------------------------------------------------------------------------
  5137.  
  5138.     or received from the disk controller. There are also a few status 
  5139.     bits in this register.
  5140.  
  5141. Bit 15    DSKBYT: 
  5142.     When bytes are read from disk, this bit is set as soon as the
  5143.     byte has been completely read.
  5144.  
  5145. Bit 14  DMAON: 
  5146.     This bit, which has the same value as DMAEN in dislen, is 
  5147.     ANDED with bit DMAEN from dmacon. When the result is a one, data 
  5148.     transfer from the disk device is possible.
  5149.  
  5150. Bit 13  DISKWRITE:
  5151.     This bit has the same value and meaning as WRITE in dsklen.
  5152.  
  5153. Bit 12    WOREQUAL: 
  5154.     This bit is set only When the dsksync register byte data will be, 
  5155.     synchronizcd with the word data.
  5156.  
  5157. Bits 11-8:    Unused
  5158.  
  5159. Bits 7-0: These bits contain the data byte.
  5160.  
  5161.         --------------------------------------------
  5162.  
  5163. dsksync    $07E    Disk synchronisation register
  5164.  
  5165.     This register contains the synchronize code for disk operations.
  5166.  
  5167.         --------------------------------------------
  5168.  
  5169. intreq    $09C    Interrupt request bits (write)
  5170. intreqr    $01E    Interrupt request bits (read)
  5171. intena    $09A    Interrupt enable bits (write)
  5172. intenar    $01C    Interrupt enable bits (read)
  5173.  
  5174.     These are the interrupt requests, interrupt enable or mask bits that 
  5175.     determine which interrupts (cyclic breaks) are allowed.
  5176.  
  5177.     This is where you can decide between request and enabling. 
  5178.     Interrupts can only occur When the corresponding enable bits are 
  5179.     set.
  5180.  
  5181.     All four registers have the same bit pattern. The request and enable 
  5182.     registers are included twice, once for writing and again for reading.
  5183.  
  5184.     Here is the bit pattern:
  5185.  
  5186. Bit 15 SET/CLR:
  5187.     (See ADKCON)
  5188.  
  5189. Bit 14 INTEN (Master Interrupt enable):
  5190.     When this bit is clear all interrupts for the following bits are 
  5191.     disabled.
  5192.  
  5193.                 PAGE 578
  5194.  
  5195. -----------------------------------------------------------------------------
  5196.  
  5197. Bit 13 EXTER:
  5198.     This bit is used to generate an external interrupt through CIAB 
  5199.     (level 6).
  5200.  
  5201. Bit 12 DSKSYN:
  5202.     This interrupt is executed when data is synchronized with the 
  5203.     DSKSYNC register (level 5).
  5204.  
  5205. Bit 11 RBF (receive buffer full):
  5206.     This is where the interrupt for the serial port is tested. It is 
  5207.     executed when the serial input buffer is full and can be read by the 
  5208.     user level 5).
  5209.  
  5210. Bits 10-7 AUD3-0:
  5211.     An interrupt is executed when sound data will be processed through 
  5212.     the DMA channel. In manual mode this interrupt is executed when the 
  5213.     audio data registers are ready to operate on new data (level 4).
  5214.  
  5215. Bit 6 BLIT (blitter finished):
  5216.     This bit is set When the Blitter has completed its work (level 3).
  5217.  
  5218. Bit 5 VERTB:
  5219.     An interrupt routine, which resets many pointers and executes other 
  5220.     system tasks, is performed for every raster return.
  5221.  
  5222. Bit 4 COPPER:
  5223.     COPPER indicates that a Copper interrupt will be executed. Just as 
  5224.     it can change almost any register, the Copper can change any of 
  5225.     these these bits. After the entire screen has been displayed and 
  5226.     the electronic beam reached the DIWSTOP position, the Copper 
  5227.     interrupt occurs. This enables the 68000 to process special tasks 
  5228.     during the raster return.
  5229.  
  5230. Bit 3 PORTS:
  5231.     PORTS indicates an interrupt that is executed during the low 
  5232.     processor cycle INT2 (level 2).
  5233.  
  5234. Bit 2 SOFT:
  5235.     This bit is reserved for software interrupts.
  5236.  
  5237. Bit 1 DSKBLK (Disk block finished):
  5238.     DSKBLK indicates that a dats transfer through the disk DMA channel 
  5239.     is complete (level 1).
  5240.  
  5241. Bit 0 TBE (transmit buffer empty):
  5242.     TBE indicates that the UART (Universal Asynchronous 
  5243.     Receiver/Transmitter) output buffer can receive data and you can 
  5244.     write into this buffer (level 1).
  5245.  
  5246.                 PAGE 579
  5247.  
  5248. -----------------------------------------------------------------------------
  5249.  
  5250.     Usually by setting the processor lines INT0, INT1 and INT2 low, there 
  5251.     could be seven different interrupts. These would only be system 
  5252.     interrups.
  5253.  
  5254.     However, the Amiga further specifies these system interrupts within 
  5255.     the intterrupt handler, which produces more than seven possible 
  5256.     interrupt levels.
  5257.  
  5258.         --------------------------------------------
  5259.  
  5260. joy0dat $00A    Joystic/mouse 1 (left port)
  5261. joy1dat    $00C    Joystic/mouse 2 (right port)
  5262.  
  5263.     These two registers provide information for the status of the entry 
  5264.     device (joystick, mouse, lightpen, potentiometer, etc.) that is 
  5265.     connected to the related control port. The following applies to the 
  5266.     specific entry devices:
  5267.  
  5268. Mouse or trackball:
  5269.     For these devices the register contains a value that is proportional 
  5270.     to the actual movement. This movement is split between the 
  5271.     horizontal (x direction) and vertical (Y direction) in the 
  5272.     register. Bits 15-8 contain the vertical movement and bits 7-0 
  5273.     contain the horizontal movement. These register values come from the 
  5274.     rotation of the ball, which turns the raster sliders between 
  5275.     light sensors.
  5276.  
  5277.     Breaking the light sensor contact and then making contact again 
  5278.     represents one impulse. The Amiga mouse sends 200 impulses per inch. 
  5279.     These two bytes are then counters of the light impulse breaks.
  5280.  
  5281.     The counters increase when you move the mouse left or down and 
  5282.     decrease when you move the mouse right or up. To determine the 
  5283.     movement direction, compare the difference of the current value to 
  5284.     the new value. When the difference is negative, the mouse is moving 
  5285.     down or right.
  5286.  
  5287.     In order to make the mouse position available to Intuition, this 
  5288.     register is read and cleared after each vertical blank.
  5289.  
  5290.     The left mouse button is read through bit six of the CIAA register 
  5291.     $BFE001. The right mouse button is read from the pot0dat register.
  5292.  
  5293. The Joystick:
  5294.     Testing for joystick positions is easier than testing mouse 
  5295.     movements. When bits one or nine for joyO/1dat are set, the 
  5296.     joystick has been moved left or right. To check for up and down 
  5297.     movement, you must XOR bit nine and eight with bits one and zero. 
  5298.     The fire button for a joystick in the left port is tested the same 
  5299.     way as the left mouse button. The fire button for the right joystick 
  5300.     is read from bit five of register $BFE001.
  5301.  
  5302.                 PAGE 580
  5303.  
  5304. -----------------------------------------------------------------------------
  5305.  
  5306.     The typical programmer shouldn't try direct reading of the joystick 
  5307.     and mouse because the system software handles this for you. However, 
  5308.     when the system does not satisfy your control requirement, you could 
  5309.     experiment with the information presented here.
  5310.  
  5311.         --------------------------------------------
  5312.  
  5313. joytest    $036    Write all mouse counters
  5314.  
  5315.     The values written to this register are transferred to both 
  5316.     joy0dat and joy1dat registers. This allows you to initialise both of 
  5317.     them at the same time.
  5318.  
  5319. pot0dat    $012    Pot counter left (vert, horiz).
  5320. pot1dat    $014    Pot counter right (vert, horiz).
  5321.  
  5322.     Like most computers, paddles can also be used with the Amiga. 
  5323.     Those are simply potentiometers that are read every sixtieth of a 
  5324.     second for their current position.
  5325.  
  5326.     When you set the starbit in potgo, electricity is sent through the 
  5327.     resistor via a capacitor. The capacitor loads for a short time (about 
  5328.     eight raster rows) and then unloads. Then the actual Load of the 
  5329.     capacitor is compared to a standard value.
  5330.  
  5331.     If the current load is higher than the standard, a previously cleared 
  5332.     counter is incremented. When the load is smaller, the compare 
  5333.     operation is cancelled and the proportional resistance value is 
  5334.     stored in this register. You can connect two of these paddles to 
  5335.     each control port which is allowed for proportional joysticks. 
  5336.     Test the paddle fire buttons as usual through the left and right 
  5337.     joystick positions. Here is the bit pattern for these registers:
  5338.  
  5339. Bits 15-8 Y7-YO:
  5340.     Potentiometer position of pot at pin 9
  5341.  
  5342. Bits 7-0 X7-XO:
  5343.     Potentiometer position of pot at pin 5
  5344.  
  5345.     The electrical resistance, which must be al least 470K Ohms, plus 
  5346.     or minus ten percent is sent through pin seven (+5V, 125mA).
  5347.  
  5348.         --------------------------------------------
  5349.  
  5350. potinp    $034    Pot port data write and start
  5351. potgo    $016    Pot port data read
  5352.  
  5353.     The control ports also function as 4 bit bidirectional I/O ports. 
  5354.     These registers are used to control them:
  5355.  
  5356. Bit 15 OUTRY (right Port, Pin9)
  5357. Bit 14 DATRY
  5358.  
  5359.                 PAGE 581
  5360.  
  5361. -----------------------------------------------------------------------------
  5362.  
  5363. Bit 13 RX        (right Port, Pin 5)
  5364. Bit 12 DATRX
  5365. Bit 11 OUTLR    (left Port, Pin 9)
  5366. Bit 10 DATLR
  5367. Bit 9 OUTLX    (left Port, Pin 5)
  5368. Bit 8 DATLX
  5369.       The OUTxx bits set the line status. When these bits are set, 
  5370.       data DATxx is output. If these bits are cleared, data DATxx is read.
  5371.  
  5372. Bits 7-0 0: Reserved
  5373.  
  5374. Bit 0 START:
  5375.     When this bit is set (potgo), the capacitors are loaded and the 
  5376.     counters start counting.
  5377.  
  5378.         --------------------------------------------
  5379.  
  5380. refptr    $028    Write refresh pointer
  5381.  
  5382.     This pointer is used as a RAM refresh pointer. Instead of constantly 
  5383.     receiving electricity, the memory bits are loaded every 280 
  5384.     nanoseconds (= one memory cycle). Therefore, their old value is 
  5385.     constantly kept fresh. Because of this technique, it is possible to 
  5386.     use five volt power for most ICs.
  5387.  
  5388.     These registers should never be accessed by the 68000 or Copper 
  5389.     because this can confuse the intemal timing, which can cause loss of 
  5390.     data.
  5391.  
  5392.         --------------------------------------------
  5393.  
  5394. serdat    $030    Serial port: data and stop bits (write)
  5395.  
  5396.     The data that is writtcn to this register is further written to a 
  5397.     shifter, which transfers a byte, bit by bit, through the serial bus. 
  5398.     When this buffcr can receive data, it sends a TBE (Transmit Buffer 
  5399.     Empty) interrupt (see INTREQ). Depending on the setting of the LONG 
  5400.     bit in the serper register, either eight or nine data bits are used.
  5401.  
  5402. Bits 15-10: 0
  5403.  
  5404. Bit 9:         Stopbit
  5405.  
  5406. Bits 8-0:     Databits
  5407.  
  5408.         --------------------------------------------
  5409.  
  5410. serdatr $018    Serial port: dats and status (read)
  5411.  
  5412.     This register, which is the opposite of serdat, contains the data 
  5413.     bits receivcd from the buffer through the shifter. Various interrupt 
  5414.     request bits (INTREQ) are also in this register.
  5415.  
  5416.                 PAGE 582
  5417.  
  5418. -----------------------------------------------------------------------------
  5419.  
  5420. Bit 15 OVERRUN:
  5421.     This bit is set when there is an input buffer overflow. Clearing RBF 
  5422.     in INTREQ clears this bit.
  5423.  
  5424. Bit 14 RBF:
  5425.  
  5426. Bit 13 TBE:
  5427.     Sec INTREQ
  5428.  
  5429. Bit 12 TSRE:
  5430.     This bit is set when the shifter register is empty.
  5431.  
  5432. Bit 11 RXD:
  5433.     The RXD processor pin receives data directly from the UART. This bit 
  5434.     can be tested directly from the 68000.
  5435.  
  5436. Bit 10: 0
  5437.  
  5438. Bit 9:     Stopbit
  5439.  
  5440. Bit 8:     Stopbit or D8
  5441.  
  5442. Bits 7-0 D7-D0:
  5443.  
  5444.         --------------------------------------------
  5445.  
  5446. serper    $032    Scrial port: rate and control
  5447.  
  5448.     With this register you set the word data width (8 or 9 bits), which 
  5449.     the serial port will send or receive. The data transfer speed is 
  5450.     also set here.
  5451.  
  5452. Bit 15 LONG:
  5453.     Setting this bit makes your data word nine bits wide.
  5454.  
  5455. Bits 14-0 RATE:
  5456.     Thesc bits specify the speed for sending or receiving one bit. 
  5457.     To calculatc the time, use the following formula: 
  5458.        (value of the lower 14 bits + 1) * 2794 microscconds.
  5459.  
  5460.  
  5461.         --------------------------------------------
  5462.  
  5463. sprpt[8] $120    Sprite x Pointer
  5464.  
  5465.     This register pair contains the starting data address for every 
  5466.     sprite (x = 0, 1, 2, 3, 4, 5, 6, 7). In order to use sprites, this 
  5467.     register must be reset by the Copper or 68000 after every raster 
  5468.     return. To display sprites, the DMA channel (dmacon/SPREN) must also 
  5469.     be active.
  5470.  
  5471.                 PAGE 583
  5472.  
  5473. -----------------------------------------------------------------------------
  5474.  
  5475. spr[8].pos    $140    Sprite X vertical & horizontal start position
  5476. spr[8].ctl    $142    Sprite X vertical stop position
  5477.  
  5478.     These registers work together to control the size, position and other 
  5479.     functions connected wilh hardware sprites. They are usually loaded 
  5480.     by the DMA conlrollcr durring the horizontal raster beam return.
  5481.  
  5482.     The positions are again specified in raster rows or normal pixels.
  5483.  
  5484. pos
  5485. ---
  5486.  
  5487. Bits 15-8 SV7-SV0,
  5488. Bits 7-0 SH8-S8H1:
  5489.     SV7=SV0 sets the vertical (Y direction) start position of sprite x. 
  5490.     SH7=SH0 contains the horizontal (X direction) start position of 
  5491.     sprite x. There are only eight bits available for each position 
  5492.     coordinate. So spr[x].ctl contains the high value bit SV8 and the 
  5493.     SH0 contains the low value bit. This allows position values between 
  5494.     zero and 512 in both horizontal and vertical directions. The movement 
  5495.     of sprites is only possible in steps of low-res pixels and in normal 
  5496.     raster rows.
  5497.  
  5498. ctl
  5499. ---
  5500.  
  5501. Bits 15-8 EV7-EV0:
  5502.     These bits contain the vertical (Y) end position of sprite x. 
  5503.     This clearly reveals that sprites can have any desired height 
  5504.     (sprites are always 16 pixels wide). Remember that the highesy bit
  5505.     (EV8) is bit one.
  5506.  
  5507. Bit 7 ATT:     
  5508.     Setting this bit selects paired sprites (0/1, 2/3, 4/5, 6/7 ) that 
  5509.     provide 15 colors per sprite instead of only three. Each sprite in a 
  5510.     pair can be movcd independantly. The 15 color bit pattern is 
  5511.     visible only When the sprites overlap.
  5512.  
  5513. Bits 6-4: Unused
  5514.  
  5515. Bit 2 SV8: 
  5516.     High value bit for SV7-SV0 in spr[x].pos
  5517.  
  5518.  
  5519. Bit 1 EV8: see EV7-EV0
  5520.  
  5521. Bit 0 SHO: 
  5522.     High value bit for SH7-SH0 in spr[x].Pos
  5523.  
  5524.  
  5525.         --------------------------------------------
  5526.  
  5527. spr[8].dataa    $144    Sprite X Image data register A
  5528. spr[8].datab    $146    Sprite X Image data register B
  5529.  
  5530. These registers contain the rows of a sprite that will be displayed. dataa 
  5531. contains the first word and datab contains the second word of any sprite. 
  5532. When dataa is written into the register, it is compared
  5533.  
  5534.                 PAGE 584
  5535.  
  5536. -----------------------------------------------------------------------------
  5537.  
  5538. with the actual raster position in SH8-SH0. When both values are the same, 
  5539. the sprite row is displayed.
  5540.  
  5541. Changing spr[x].ctl affects this comparison. The beam position is compared 
  5542. only after dataa is accessed and eventually the sprite is displayed.
  5543.  
  5544.         --------------------------------------------
  5545.  
  5546. strequ    $038    Strobe for horiz. synchronisation with VB and EQU
  5547. strvbl    $03A    Strobe for horiz. synchronisation with VB
  5548. strhor    $03C    Strobe for horiz. synchronisation
  5549. strlong    $03E    Strobe for identification of a long horizonal.
  5550.  
  5551.     These registers are used internally by the video shifter. 
  5552.     Unfortunately, we are unable to provide more detailed information 
  5553.     about them. However, the typical programmer really doesn't need 
  5554.     these registers.
  5555.  
  5556.         --------------------------------------------
  5557.  
  5558.  
  5559. vposr    $004    Highest value vertical positions bit (read)
  5560. vposw    $004    Highest value vertical positions bit (write)
  5561.  
  5562.     To synchronize actions of the 68000 with the electronic scanning 
  5563.     beam, these registers are used. So, the 68000 can wait for a 
  5564.     specific Y coordinate of the electronic beam and then take whatever     
  5565.     action is required by the Program (see WaitTOF).
  5566.  
  5567.     These registers only contain the highest value bit for the vertical 
  5568.     position and an interlaced flag.
  5569.  
  5570. Bit 15 LOF:
  5571.     This bit indicates whether or not interlace is switched on.
  5572.  
  5573. Bits 14-0: Unused
  5574.  
  5575. Bit 0 V8:    
  5576.     This is the highest value bit for the vertical electronic beam 
  5577.     position. You can also test for rows higher than 256 
  5578.     (313 for PAL and 262 for NTSC).
  5579.  
  5580.         ------------------------------------------------------------------
  5581.  
  5582. vhposr    $006    vertical and horizontal electronic beamposition (read)
  5583. vhposw    $02C    Vertical and horizontal electronic beamposition (write)
  5584.  
  5585.     These registers are used to read the current beam position or to set 
  5586.     (write) a new position, which is sometimes necessary when performing 
  5587.     tests. Usually these registers aren't used except for diagnostic 
  5588.     purposes.
  5589.  
  5590.     The bit pattern is as follows:
  5591.  
  5592.                 PAGE 585
  5593.  
  5594. -----------------------------------------------------------------------------
  5595.  
  5596. Bits 15-8  V7-V0:
  5597.     These bits contain the lowest bit values for the vertical beam 
  5598.     position. This high bit is stored in VPOSR.
  5599.  
  5600. Bits 7-0 H8-H1:
  5601.     These bits contain the actual horizontal position of the beam. The
  5602.     resolution value consists of 1/160 of the screen width.
  5603.  
  5604.                 PAGE 586
  5605.  
  5606. -----------------------------------------------------------------------------
  5607.  
  5608. The following register list is in offset address order (please remember the 
  5609. offset from $DFF000):
  5610.  
  5611.     Nr.        Name        Adress
  5612.     -------        --------------    ----------------
  5613.     000        bltddat        $000
  5614.     001        dmaconr        $002
  5615.     002        vposr        $004
  5616.     003        vhposr        $006
  5617.     004        dskdatr        $008
  5618.     005        joy0dat        $00a
  5619.     006        joy1dat        $00c
  5620.     007        clxdat        $00e
  5621.     008        adconr        $010
  5622.     009        pot0dat        $012
  5623.     010        pot1dat        $014
  5624.     011        potinp        $016
  5625.     012        serdatr        $018
  5626.     013        dskbytr        $01a
  5627.     014        intenar        $01c
  5628.     015        intreqr        $01e
  5629.     016        dskpt        $020
  5630.     017        dsklen        $024
  5631.     018        dskdat        $026
  5632.     019        reftpr        $028
  5633.     020        vposw        $02a
  5634.     021        vhposw        $02c
  5635.     022        copcon        $02e
  5636.     023        serdat        $030
  5637.     024        serper        $032
  5638.     025        potgo        $034
  5639.     026        joytest        $036
  5640.     027        strequ        $038
  5641.     028        strvbl        $03a
  5642.     029        strhor        $03c
  5643.     030        strlong        $03e
  5644.     031        bltcon0        $040
  5645.     032        bltcon1        $042
  5646.     033        bltafwm        $044
  5647.     034        bltalwm        $046
  5648.     035        bltcpt        $048    
  5649.     036        bltbpt        $04c
  5650.     037        bltapt        $050
  5651.     038        bltdpt        $054
  5652.     039        bltsize        $058
  5653.             --        $05a
  5654.             --        $05c
  5655.  
  5656.                 PAGE 587
  5657.  
  5658. -----------------------------------------------------------------------------
  5659.  
  5660.     Nr.        Name        Address
  5661.     -------        -------------    ----------------------------
  5662.             --        $05e
  5663.     040        bltcmod        $060
  5664.     041        bltbmod        $062
  5665.     042        bltamod        $064
  5666.     044        bltdmod        $066
  5667.             --        $068
  5668.             --        $06a
  5669.             --        $06c
  5670.             --        $06e
  5671.     045        bltcdat        $070
  5672.     046        bltbdat        $072
  5673.     048        bladat        $074
  5674.             --        $076
  5675.             --        $078
  5676.             --        $07a
  5677.             --        $07c
  5678.     049        dsksync        $07e
  5679.     050        cop1lc        $080
  5680.     051        cop2lc        $084
  5681.     052        copjmpl        $088
  5682.     053        copjmp2        $08a
  5683.     054        copins        $08c
  5684.     055        diwstrt        $08e
  5685.     056        diwstop        $090
  5686.     057        ddfstrt        $092
  5687.     058        ddfstop        $094
  5688.     059        dmacon        $096
  5689.     060        clxcon        $098
  5690.     061        intena        $09a
  5691.     062        intreq        $09c
  5692.     063        adkcon        $09e
  5693.  
  5694.     aud[0]
  5695.  
  5696.     064        ac_ptr        $0a0
  5697.     065        ac_len        $0a4
  5698.     066        ac_per        $0a6
  5699.     067        ac_vol        $0a8
  5700.     068        ac_dat        $0aa
  5701.             --        $0ac
  5702.             --        $0ae
  5703.     
  5704.                 PAGE 588
  5705.  
  5706. -----------------------------------------------------------------------------
  5707.  
  5708.     Nr.        Name        Address
  5709.     -------        --------------    ---------------------------
  5710.  
  5711.     aud[l]
  5712.  
  5713.     069        ac_ptr        $0b0
  5714.     070        ac_len        $0b4
  5715.     071        ac_per        $0b6
  5716.     072        ac_vol        $0b8
  5717.     073        ac_dat        $0ba
  5718.             --        $0bc
  5719.             --        $0be
  5720.  
  5721.     aud[2]
  5722.  
  5723.     074        ac_ptr        $0c0
  5724.     075        ac_len        $0c4
  5725.     076        ac_per        $0c6
  5726.     077        ac_vol        $0c8
  5727.     078        ac_dat        $0ca
  5728.             --        $0cc
  5729.             --        $0ce
  5730.  
  5731.     aud[3]
  5732.  
  5733.     079        ac_ptr        $0d0
  5734.     080        ac_len        $0d4
  5735.     081        ac_per        $0d6
  5736.     082        ac_vol        $0d8
  5737.     083        ac_dat        $Oda
  5738.             --        $0dc
  5739.             --        $0de
  5740.     084        bltpt[0]    $0e0
  5741.     085        bltpt[1]    $0e4
  5742.     086        bltpt[2]    $0e8
  5743.     087        bltpt[3]    $0ec
  5744.     088        bltpt[4]    $0f0
  5745.     089        bllpt[5]    $0f4
  5746.             ---        $0f8
  5747.             --        $0fa
  5748.             --        $0fc
  5749.             --        $0fe
  5750.     090        bplcon0        $100
  5751.     091        bplcon1        $102
  5752.     092        bplcon2        $104
  5753.             --        $106
  5754.     093        bpl1mod        $108
  5755.  
  5756.                 PAGE 589
  5757.  
  5758. -----------------------------------------------------------------------------
  5759.  
  5760.     Nr.        Name        Address
  5761.     -------        --------------    -------------------------
  5762.     
  5763.     094        bpl2mod        $10a
  5764.             --        $10c
  5765.             --        $10e
  5766.     095        bpl1dat        $110
  5767.     096        bpl2dat        $112
  5768.     097        bpl3dat        $114
  5769.     098        bpl4dat        $116
  5770.     099        bpl5dat        $118
  5771.     100        bpl6dat        $11a
  5772.             --        $11c
  5773.             --        $11e
  5774.     101        sprpt[0]    $120
  5775.     102        sprpt[1]    $124
  5776.     103        sprpt[2]    $128
  5777.     104        sprpt[3]    $12e
  5778.     105        sprpt[4]    $130
  5779.     106        sprpt[5]    $134
  5780.     107        sprpt[6]    $138
  5781.     108        sprpt[7]    $13c
  5782.  
  5783.     spr[0]
  5784.  
  5785.     109        pos        $140
  5786.     110        ctl        $142
  5787.     111        dataa        $144
  5788.     112        datab        $146
  5789.  
  5790.     spr[1]
  5791.  
  5792.     113        pos        $148
  5793.     114        cd        $14a
  5794.     IIS        dataa        $14c
  5795.     116        datab        $14e
  5796.  
  5797.     spr[2]
  5798.  
  5799.     117        pos        $150
  5800.     118        cd        $152
  5801.     119        dataa        $154
  5802.     120        datab        $156
  5803.  
  5804.                 PAGE 590
  5805.  
  5806. -----------------------------------------------------------------------------
  5807.  
  5808.     Nr.        Name        Address
  5809.     -------        --------------    ------------------------------
  5810.  
  5811.     spr[3]
  5812.  
  5813.     121        pos        $158
  5814.     122        ctl        $15a
  5815.     123        dataa        $l5c
  5816.     12A        datab        $15e
  5817.  
  5818.     spr[4]
  5819.  
  5820.     125        pos        $160
  5821.     126        ctl        $162
  5822.     127        dataa        $164
  5823.     128        datab        $166
  5824.  
  5825.     spr[5]
  5826.  
  5827.     129        pos        $168
  5828.     130        cd        $16a
  5829.     131        dataa        $16c
  5830.     132        datab        $16e
  5831.  
  5832.     spr[6]
  5833.  
  5834.     133        pos        $170
  5835.     134        ctl        $172
  5836.     135        dataa        $174
  5837.     136        datab        $176
  5838.  
  5839.     spr[7]
  5840.  
  5841.     137        pos        $178
  5842.     138        cd        $17a
  5843.     139        dataa        $17c
  5844.     140        datab        $17c
  5845.     
  5846.     141        color00        $180
  5847.     142        color01        $182
  5848.     143        color02        $184
  5849.     144        color03        $186
  5850.     145        color04        $188
  5851.     146        color05        $18a
  5852.     147        color06        $18c
  5853.     148        color07        $18e
  5854.     149        color08        $190
  5855.     150        color09        $192
  5856.  
  5857.                 PAGE 591
  5858.  
  5859. -----------------------------------------------------------------------------
  5860.  
  5861.     Nr.        Name        Address
  5862.     -------        --------------    ------------------
  5863.     
  5864.     151        color10        $194
  5865.     152        color11        $196
  5866.     153        color12        $198
  5867.     154        color13        $19a
  5868.     155        color14        $19c
  5869.     156        color15        $19e
  5870.     157        colorl6        $1a0
  5871.     158        colorl7        $1a2
  5872.     159        colorl8        $1a4
  5873.     160        colorl9        $1a6
  5874.     161        color20        $1a8
  5875.     162        color21        $1aa
  5876.     163        color22        $1ac
  5877.     164        color23        $1ae
  5878.     165        color24        $1b0
  5879.     166        color25        $1b2
  5880.     167        color26        $1b4
  5881.     168        color27        $1b6
  5882.     169        color28        $1b8
  5883.     170        color29        $1ba
  5884.     171        color30        $1be
  5885.     172        color31        $1be
  5886.     
  5887.     xxx        NO-OP        $1fe
  5888.  
  5889.                 PAGE 592
  5890.  
  5891. --------------------------------------------------------------------------
  5892.  
  5893.                      INDEX
  5894.                 ------
  5895.  
  5896. 3-D effects                  39       AnimOb.AnY            482
  5897. 1024*1024 paint program         293       AnimOb.HeadComp        481
  5898.                            AnimOb.PrevOb                483
  5899. AbortDoubleBuffer            180       AnimOb.XAccel        482
  5900. Absolute  address          9       AnimOb.XVel                482
  5901. absolute coordinades          9       AnimOb.YAccel        482
  5902. access counter                  216       AnimOb.YVel                482
  5903. action-verbs                 51       AnimObs               479, 484
  5904. activity menu 1                  5       AnimORoutine                483
  5905. AddAnimOb           483, 527       AREA                         31
  5906. AddBob (&Bob, &RastPort)        527       Area... functions        356
  5907. AddFont (&Textfont)             527       AreaDraw (&RastPort, x, y)    528
  5908. Addressing                  8       AreaEllipse                529
  5909. AddVSprite (&VSprite, Rastport)    528       AreaEnd (&RastPort)        529
  5910. AddVSpri@                455       AREAFILL        31, 32, 33, 124
  5911. AllocMem (NumBytes, Use)    553       AreaInfo                124
  5912. AllocMem()            157, 203, 319       AreaInfo structure            356
  5913. AllocRaster (Width, Height)     528       AreaMove (&RastPort, x, y)    530
  5914. AllocRaster()    170, 203, 204, 319       AreaPtSz            126
  5915. Amiga libraries                316       ASCII            709
  5916. AND                 53       ASCII codes            216
  5917. Angle parameters         24       AskFont (&RastPort &TextAttr    530
  5918.  
  5919. Animate (&AnimOb,&RastPort)    528       AskSoftStyle (&RastPort)    530
  5920. Animated bit-planes          80       aspect ratio                20, 23
  5921. Animation             21, 55       asynchronous                    274
  5922.  
  5923. animation            479, 481       AvailFonts (&Buffer, BufferSize, 
  5924.                             Type)           550
  5925. Animation Components        479        
  5926. Animation Objects        479           AvailFonts            228
  5927. AnimComp            481           AvailFonts structure        393
  5928. AnimComp structure        480
  5929. AnimComp.AnimBob        481           Backdrop (Layerbackdrop)    197
  5930. AnimComp.AnimCRoutine        481           backdrop window         99
  5931. AnimComp.NextComp        480           Backup-Register        117
  5932. AnimComp.PrevComp        480           bar graph             19
  5933. AnimComp.timeset        481           BASIC interpreter         93
  5934. AnimComp.XTrans            482           binary numbers         35
  5935. AnimComp.YTrans            483           binary pattern mask         36
  5936. AnimComps           479, 482           bit pattern            355
  5937. AnimOb               481, 482           Bit-map  117,123,166,319,402,417
  5938. AnimOb.AnX            482           bit-map structure         321
  5939.  
  5940.                 PAGE 593
  5941.  
  5942. -----------------------------------------------------------------------------
  5943.  
  5944. bit-planes 46,80,81,149,319,355           CloseScreen(&Screen)        551
  5945.             402,415           CloseWindow(&Window)        551
  5946. Bitmap            149,344           CLS statement         41
  5947. Bitmap Offset            153           CMOVE           495, 497
  5948. Blitter     52, 349, 399, 400, 465           Collision mask         76
  5949. Blitter objects            465           collision            440
  5950. BltBitMap      278, 400, 530           collision control       456, 466
  5951. BltBitMapRastPort         531           collision detection        496
  5952. BltClear  (&Memory, NumBytes, Flags)       collisions          456, 458, 484
  5953.                 531               CollMask          456, 466, 467
  5954. BltClear            399               COLOR statement         33
  5955. BltTemplate      407, 412, 532           color            382
  5956. bmap file             87           color components        382
  5957. Bob.BobComp            480           color cycling        44, 479
  5958. Bob.SaveBuffer            477           color depth              4
  5959. BOBISCOMP            480           color map                318
  5960. bobs 55,85,458,465,466,467,468,           color pens            339
  5961.           476, 479, 484           color registers          4
  5962. BOBVSpritee.Depth        466           ColorMap           153, 344
  5963. bold print            215           ColorMap structure        318
  5964. border color            347               ColorPattern                134
  5965. borderless window         99           colors             69
  5966. BorderLine           456, 466           COMPLEMENT               125, 340
  5967. brush effect              9           constant            503
  5968. byte field             95               ConvertFD             87
  5969.                            Copper     153,180,185,452,495
  5970. C language            315           Copper list1 53,169,174,181,317,
  5971. CEND                497            323,384,382,455,477,495,496,542
  5972. ChangeSprite           436, 532           Copper programming        435
  5973. Character spacing           128           CreateUpFrontLayer        190,203
  5974. Character width            127           cursor                126
  5975. CharData        235,412           CWAIT            496,497
  5976. charLoc                235
  5977. checkmark         69,105               damage list            195
  5978. CHR$(0)                100           DBuffPacket                477
  5979.  
  5980. CIRCLE statement        24,30           DECLARE FUNCTION LIBRARY     90
  5981. CIRCLE                 20           DEFINT             36
  5982. ClearEOL(&RastPort)         533           Delay (Time)            553
  5983. ClearPointer            109           DeleteLayer            190,204
  5984. ClearScreen(&RastPort)      533           Depth             69
  5985. ClipBlit           402, 533           DIM instruction         36
  5986. ClipRect           192, 194           Disk fonts            221
  5987. CLOSE                 50           diskfont.bmap         87
  5988. Close gadget             99           diskfont.libraries        550
  5989. CloseFont (&TextFont)       533           Diskfont.library            221
  5990. CloseLibrary (&BasePointer) 554           DiskFontBase functions    550
  5991. CloseRequest            199           DisownBlitter()        534
  5992.  
  5993.                 PAGE 594
  5994.  
  5995. -----------------------------------------------------------------------------
  5996.  
  5997. DisplayBeep (&Screen)        551           Font Data            216
  5998. DMA                        451           Font kern            217
  5999. DoCollision        457,464,534           Font Style Flags        390
  6000. dos.bmap             87           font                213
  6001. doScroll            205           font reader                237
  6002. Doulbe Buffering    476,477           font style             392
  6003. double buffered displays    423           fonts        219,234,391
  6004. double buffering            175               Fore/background gadget        99
  6005. Double Buffering Off        180           FreeColorMap(&ColorMap)    535
  6006. Double Buffering On         179           FreeColorMap()             170
  6007. DragBar                     99               FreeCopList(&CopList)    536
  6008. Draw()              332,534           FreeMem(&Memory,Size)    554
  6009. DrawGList                   204           FreeMem()                157,204
  6010. DrawEllipse            534               FreeRaster()       170, 204, 536
  6011. DrawGList            477,535           FreeSprite(SprNumber)    536
  6012. Drawing color            124           FreeSprite (Status)        436
  6013. Drawing Mode            125           FreeVPortCopLists(&ViewPort) 537
  6014. drawing                 69           FreeVPortCopList()       170
  6015. drawing pens                341           function plotter             12
  6016. Drawmode            340    
  6017. Dual Playfield mode        422           gadget structure            103
  6018. DUALPF flag            422           GEL                464
  6019. DUALPF mode           155, 477           GEL list           464, 527
  6020. dualplayfield            476           GELGONE                464
  6021. GelsInfo            124
  6022. Eddi II                 56           GelsInfo structure        483
  6023. ellipsoids                    3           GelsInfo.lastcolor        452
  6024. ERASE                 50           Genlock Video        155
  6025. exec.bmap             87           GET                  46, 71
  6026. exec_lib             87           GetColorMap (NumberColors)    537
  6027. Exit (ReturnValue)        553           GetColorMap           170, 174
  6028. EXOR                340           GetMsg (&Port)        554
  6029. Extra Halfbrite            155           GetRGB4                537
  6030. EXTRA_HALFBRITE            418           Getsprite          436, 452, 537
  6031.                        GfxBase            316
  6032. fd                 67           GfxBase routines        527
  6033. fill            30, 347           GfxBase structure        324
  6034. fill modes            357           GimmeZeroZero PArameters    105
  6035. fill patterns               354           GimmeZeroZero windows     99,101
  6036. filled rectangles         17           graphic cursor          9
  6037. First ClipRect            192           graphic elements(GELS)    465
  6038. First window            115           graphic library        141
  6039. FIags                194           graphic primitives   122,129,381
  6040. flags                72, 116           graphic.library       316, 345
  6041. Flood (&RastPort,Mode,x,y)  535           graphics.bmap         87
  6042. Flood function                347           graphics_lib.fd         87
  6043. Font attribute            215           Guru Mediation         93,400
  6044.  
  6045.                 PAGE 595
  6046.  
  6047. -----------------------------------------------------------------------------
  6048.  
  6049. Halfbrite      156, 320, 418           Inverting graphics        52
  6050. HalfBriteOff            160           IODRPReg               259
  6051. HalfBriteOn            160           IODRPReg structure           261
  6052. HAM               155, 320
  6053. HAM mode      161, 419, 421           JAM1                   341
  6054. hardcopies                259           JAM2                   341
  6055. Hardcopy 1            262    
  6056. Hardcopy III        268,271           Kickstart               316
  6057. Hardcopy II            265        
  6058. Hardcopy V            274           LACE flag               415
  6059. hardware registers        181           Lattice V3.10 compiler      315
  6060. hardware sprites        435           Layer               315
  6061. hardware sprites        451           Layer data structure           191
  6062. hexadecimal             35           Layer backdrop              196
  6063. Hi-res                155          LayerInfo               117
  6064. hi-res mode                 15           Layers               188
  6065. hi-resolution graphics          1           layers libraries            190
  6066. Hitmask                457            layers.bmap                87
  6067. hold-and-modify        161,419           layers_lib            87  
  6068.                        Layersimple               196
  6069. I/O Dump RastPort Request   259           Layersmart               196
  6070. IDCMP FIags            104           layersuper          194, 196
  6071. IFF                279           LIBRARY CLOSE        88
  6072. ILBM files            291           LIBRARY statement        88
  6073. ILBM graphic            280           library           87, 527
  6074. include files            503               LINE              10,19,30     
  6075. InitArea            538           Line pattern               126
  6076. InitBitMap            538           LoadRGB4         170, 174, 540
  6077. InitBitMap()        170,204           LoadView(&View)         323,541
  6078. InitCop()        181,182           LoadView           170,174
  6079. InitGels            538           Lock-Fields               194
  6080. InitMasks(&VSprite)        539           Locklayer               194
  6081. InitRastPort (&RastPort)    539           long field                95
  6082. InitTmpRas                539           MakeDoubleBuffer            179
  6083. InitView(&View)            540           MakeScreen (&Screen)           552
  6084. InitView           170, 173           MakeVPort(&View,&ViewPort)  541
  6085. InitVPort(&ViewPort)        540           MakeVPort          174, 323
  6086. InitVPort           170, 174               MakeVPort()               170
  6087. INPUT                 50           MeMask               457
  6088. Interchange File Format     279           menu header               100
  6089. Interlaced mode            155,414           Message               251
  6090. Intuition             93           MESSAGE port           104,195,260
  6091. Intuition.Screen        476           message ports           195
  6092. intuition.bmap             87           Messages               195
  6093. intuition_lib             87           Minterms           237,401    
  6094. IntuitionBase routines        476               ModifyIDCMP               552
  6095. INVERSVID           125, 341
  6096.  
  6097.                 PAGE 596
  6098.  
  6099. -----------------------------------------------------------------------------
  6100.  
  6101. Modulo              216, 412          Paint-1024 program instructions
  6102.                                        311
  6103. MoirE patterns            10          PAL systems             4
  6104. MOUSE function             2          palette 41, 42, 43, 80, 318, 382
  6105. mouse coordinates      97, 116          parameters             4
  6106. mouse pointer           106          PATTERN           35, 129
  6107.  
  6108. MOVE               180          Patterned areas        34, 35
  6109. Move (&RastPort, X, Y)       541          PEEK                95
  6110. Move()                   141        PEEKL                95
  6111. MoveSprite           541          PEEKW                95
  6112. MoveWindow           109              pentagram                32
  6113. MrgCop (&View)           542          PFBA                   155
  6114. MrgCop               170,174          pixel                 1
  6115. multi-colored patterns 140,355          PlaneOnOff            82
  6116.                       PlanePick                81
  6117. NewWindow structure        345          POINT statement         7
  6118. Next screen            115          Pointer to Window           206
  6119. Next ViewPort            153,168          POKE                95
  6120. NextSeq                480          POKEL                95
  6121. NTSC video              4          POKEW                95
  6122.                       Polydraw               543
  6123.                       Preferences               390
  6124. OBJECT statement             74
  6125. OBJECT-SHAPE          56,71          PRESET               3,6
  6126. OBJECT.AX/Y             74          PrevSeq               480
  6127. OBJECT.CLIP          78,79          printer.device               259
  6128. OBJECT.HIT          76,79          proportional font           217
  6129. OBJECT.ON             74          PSET                       1,6
  6130. OBJECT.PRIORITY             79          pseudo menus            15
  6131. OBJECT.SHAPE             74          PUT                     46,71
  6132. OBJECT.START             74          PUT-PRESET            53
  6133. OBJECT.VX/Y             74          PUT-PSET                53
  6134. OBJECT.X/Y             74
  6135. OBJEDIT program             56          quix                    11
  6136. ON ERROR GOTO             16
  6137. OPEN                 50          RasInfo               167
  6138. OpenDiskFont (&TextAttr)    551          RasInfo Block               154
  6139. OpenFont (&TextAttr)        542          RasInfo structure       322,476
  6140. OpenFont            391          RastPort 100, 117, 122, 148, 192 
  6141.                                   344, 412
  6142. OpenLibrary            554        
  6143. OpenLibrary                316          RastPort border            101
  6144. OpenScreen (&NewScreen)        552          RastPort structure   122,123,188 
  6145.                                        323
  6146. OPTION BASE             38          ReadPixel (&RastPort, X, Y)  543
  6147. OR                 53          ReadPixel            90
  6148. Overlay Flag             75          rectangle           127,349
  6149. Overscan            414          RectFill               543
  6150. OwnBlitter()             542          refresh mode            99
  6151.                       relative address         9, 30
  6152.  
  6153. PAINT              27,30          ReMakeDisplay       157,160,477,552
  6154.  
  6155.                 PAGE 597
  6156.  
  6157. -----------------------------------------------------------------------------
  6158.  
  6159. RemFont (&TextFont)        544         SetWindowTitles        204,205
  6160. RemIBob                544         Shadow mask                 75
  6161. RemVSprite(&VSprite)        544         Simple Refresh (Layersimple)  196
  6162. ReplyMsg (&Port)        555         SimpleSprite structure           435
  6163. ReplyPort            278         SizeWindow               111
  6164. Requester Handling        100         sizing gadget             96,99
  6165. requester                180             SKIP                   180
  6166. resolution            413         Smart Refresh (Layersmart)    196
  6167. ReThinkDisplay()        553         Smart refresh            99
  6168. RINGTRIGGER            481         Software Failure           400
  6169. RingXTrans            483         SortGList (&RastPort)           548
  6170. RingYTrans            483         SortGList               455
  6171. ROM routines            316         SprColor            85,454
  6172. ROM versions            316         Sprite collisions           440
  6173.                      sprite                55
  6174. SADD                 88         sprite image               104
  6175. SaveBack flag             72         SPRITE ATTACHED           439
  6176. SaveBob                 75         SpriteData structure           439
  6177. SAveBuffer            477         Sprites   155,435,438,439,495,496
  6178. Scaling                 16         STEP                 9
  6179. Screen dimensions        116         structAnimComp               505
  6180. Screen Structure    115,120         struct AnimOb               506
  6181. screen                 68         struct AreaInfo           508
  6182. screen colors            117         struct AvailFonts           508
  6183. screen gadgets            117         struct AvailFontsHeader       508
  6184. screen title            105         struct BitMap               508
  6185. Screen/Intuition        114         struct Bob               509
  6186. ScreenByte            118         struct ColorMap           511
  6187. Screenhere            118         struct Custom               511
  6188. Scrolling            195         structDBuffPacket           511
  6189. ScrollLayer()        203,205         struct GelsInfo           512
  6190. ScrollRaster            544         struct GfxBase               511
  6191. Screen                118         struct IntuiMessage           513
  6192. ScrollVPort (&ViewPort)        545         struct IntuitionBase           513
  6193. SetAPen (&RastPort 
  6194.     Colorregister)         545         struct NewScreen           515
  6195. SetBPen(&RastPort, 
  6196.     Colorregiter        545         struct NewWindow           513
  6197. SetCollision             546         struct RasInfo               519
  6198. SetColllision             484         struct RastPort           516
  6199. SetDrMd(&RastPort Mode)        546         struct Screen               519
  6200. SetDrMd            125,141         struct SimpleSprite           520
  6201. SetFont (&RastPort, &Font)  546         struct TextAttr           520
  6202. SetPointer            106         struct TextFont           521
  6203. SetRast (&RastPort, 
  6204.     Colorregister)        547         struct View               521
  6205. SetRast                204         struct ViewPort           522
  6206. SetRG4CM            547         struct VSprite               523
  6207. SetRGB4                547         struct Window               525
  6208. SetSoftSlyle            548
  6209.  
  6210.                 PAGE 598
  6211.  
  6212. -----------------------------------------------------------------------------
  6213.  
  6214. StyleEnable            392         View structure               173
  6215. Superbit             99         ViewAddress            168
  6216. Superbilmap (Layersuper)    196         ViewPort  117,151,166,188,317,323,
  6217. Superbitmap       194, 204, 293                      344, 381, 413
  6218. Superbitmap Paint Program   294         ViewPort Modes            153
  6219. SuperClipRect            194         ViewPort structure       153, 318
  6220. supergraphic            211         ViewPort            345
  6221. SWAP-assignments         40         VP_HIDE           155, 435
  6222. switch element            103         VSprite            459
  6223. synchronous            274         VSprite flag            464,466
  6224. system components        212         VSprite structure    456,466,453
  6225. system crash             90         VSprite variables        467
  6226. systEm data structure        212         VSprite.OldX            477
  6227. system libraries         88         VSprite.OldY            477
  6228.                      Vspritess 435,451,453,456,458,465,
  6229. Text                548                       467, 495
  6230. Textheight            127
  6231. text length            389         WAIT                180
  6232. text styles            144         WaitBlit ()            549
  6233. Text()                141         WaitBOVP (&ViewPort)        549
  6234. TextAtt                218         WaitTOF          204, 205, 549
  6235. TextAttr structure     390, 393         wd                 67
  6236. TextFont            214         width table            217
  6237. TextFont data Structure        215         WINDOW OUTPUT             95
  6238. TextFont structure  220,235,250         Window                 93
  6239. TextLength            548         Window borders            101
  6240. TIMER                 29         Window colors            105
  6241. timer                481         Window limits             98
  6242. timeset                483         Window modes             99
  6243. Title text            100         window data structure        96, 120
  6244. TmpRas                124         window size             96
  6245. TmpRas                207         WINDOW(7)            93, 103
  6246. topaz 8                213         WINDOW(8)           122, 214
  6247. topaz 9                213         WindowLimits            110
  6248. topaz font            221         windows           103, 345
  6249. transmit            179         WindowToBack                113
  6250. WindowToFront            113
  6251. UCopList            181         word field             95
  6252. Undefined function values    16         WRITE                 50
  6253. UnLocklayer            194         Writemask            124
  6254. user Copper list        181        WritePixel (&RastPort, X, Y)    550
  6255. user data            117        WritePixel (&RastPort, X, Y)    327
  6256. UserCopperList            495
  6257.                     XOR                 51
  6258. VBeamPos()            549
  6259. View                167
  6260. View               317, 413
  6261.  
  6262.                 PAGE 599
  6263.  
  6264. -----------------------------------------------------------------------------
  6265.                 T H E   E N D 
  6266. -----------------------------------------------------------------------------
  6267.     
  6268.